public class Test2 {
public static void main(String[] args) {
/*String str = "..............";
str.length();// 获取整个字符串的长度
str.trim();// 去掉字符串两边的空格
str.charAt(int i);// 获取某个索引值上的字符
str.contains(CharSequence s);// 是否包含某个字符串
str.startWith(String s);
str.endWith(String s);
replace(char o, char n);
replace(CharSequence o, CharSequence n);
split(String s);
toUpperCase();
toLowerCase();
valueOf(any args);
str.indexOf(String s);//取这个字符串第一次出现的索引位置
str.lastIndexOf(String s);//取这个字符串最后一次出现的索引位置
str.substring(int i);//取索引值为这个整数参数后面的字符串
str.substring(int a, int b);//取a和b之间的字符串(不包括b)*/
// 1, 方法
String s = "hanqi";
p(s);
int x = 20;
int y = 30;
int c = add(x, y);
p(c);
Byte b = 10;
Byte b1 = null;
// 包装类(针对于基础数据类型)
// null (引用类型)
/*
byte -->Byte
short -->Short
int -->Integer
long -->Long
float -->Float
double -->Double
boolean -->Boolean
char -->Character
*/
String num = "123";
int _num = Integer.parseInt(num); // Integer
System.out.println(_num + 20);
// 自动装箱 / 拆箱
int i = 10;
Integer i2 = i;
// jdk 1.5
Integer i3 = 20;
System.out.println(Integer.MAX_VALUE);
System.out.println(Long.MIN_VALUE);
System.out.println(Float.MAX_VALUE);
System.out.println(Double.MAX_VALUE);
System.out.println(Integer.toBinaryString(i));
System.out.println(Integer.toOctalString(i)); // 八进制
System.out.println(Integer.toHexString(i)); // 十六进制
String s2 = "10101111100";
System.out.println(Integer.parseInt(s2, 8));
}
public static void p(Object o) {
System.out.println(o);
}
public static int add(int a, int b) {
int result = a + b;
return result;
}
}