这个是String类上面的注释,我用谷歌翻译翻译的,虽然有点语法上的问题,但是大概都可以翻译出来 /** * The {@code String} class represents character strings. All * string literals in Java programs, such as {@code "abc"}, are * implemented as instances of this class. * <p> * Strings are…
一.String类是什么 public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; /** Cache the hash code for the string */ private int hash; // Def…
赋值运算符 (一)JAVA种的赋值运算符 = ,代表代表的等于,一般的形式是 左边变量名称 = 右边的需要赋的指或者表达式,如果左侧的变量类型级别比较高,就把右侧的数据转换成左侧相同的高级数据,然后再复制给左边的变量.否则需要用强制类型转换. int a,b,c; a = 13 ; b = 12 ; c = 12 ; int i = 10 ;//强制类型转换 byte b = (byte)i; /* …
运算符: (1)算术运算符: +,-,*,/,%,++,--(加.减.乘.除.取余.自增,自减) ++和--的注意事项: a:他们的作用是自增或者自减 b:使用 1.单独使用 放在操作数据的前面和后面效果一样. a++或者++a效果一样. 2.参与操作使用 放在操作数的前面:先自增或者自减,再参与操作 放在操作数的后面:先参与操作,再自增或者自减 int a = 10; int b = ++a; //b=11,a=11 int a = 10; int b = a++; //b=10,a=11 (…
1.算术运算符 算术运算符: +,-,*,/,% /:取的是两个数的商,当两个数是整数,不整除的情况,结果不包含小数部分 %:取的是两个数的余数. 字符串和+联合使用:此时的+称为连接符.++,--都是对变量进行操作 /* 演示算术运算符 */ public class ArithmeticDemo{ public static void main(String[] args){ // int i = 10; // int ii = 3; // System.out.println(i + ii…
demo: public class TestStringEquals { public static void main(String[] args) { String a = "test"; String b = "test"; String c = new String("test"); String d = new String("test"); String e = a; String f = new String(…
1.String的引用: 下列代码执行后的结果为: public class Test { public static void main(String[] args) { StringBuffer a = new StringBuffer("A"); StringBuffer b = new StringBuffer("B"); operator(a, b); System.out.println(a + "," + b); } public …