java基础ch1

来源:互联网 发布:win10限制软件联网 编辑:程序博客网 时间:2024/05/16 09:42
 

1.java基本类型:int、short、long、byte、float、double、boolean、char
2.变量和常量,变量:public int i;public String str中i和str为变量;public final int I=10;public final String STR="hello"

中I和STR为常量。
3.如果想要遍历一个字符串,并依次查看每一个代码点:int cp = String.codePointAt(i);
4.String StirngBuffer StringBuilder
5.判断二个字符串是否相同使用equals()方法,不需要区别大小写使用equalsLgnoreCase()方法,字符串比较compareTo(String other);
判断字符串是否以suffix结尾endsWith(String suffix)/startsWith(String

suffix);subString/replace/indexof/toUpperCase/toLowerCase/trim等方法

6.控制台标准输入流:Scanner in = new Scanner(System.in);in.nextLine();
7.块的作用域{}但NEW实例执行
8.多重条件判断和选择时需要注意Switch(int)语句只能是int类型和enum类型。
9.break、continue、return,break跳出循环体;continue跳出本次循环;return跳出该方法体;
10.数字copey:System.arrayCopy(from,fromindex,to,toindex,count);

原创粉丝点击