根据Integer类中不同的构造器去创建对象,然后返回对象的值,调用 Integer类中的MAX-VALUE字段和MIN-VALUE字段,查看区间。
自义一个字符串,对字符串进行以下操作,索引长度,任意一个字符在字符串中第一次出现的位置,最后一次出现的位置,对字符串按照一定的标准进行分割
public static void main(String[] args) {
Integer max = new Integer(Integer.MAX_VALUE);
Integer min = Integer.MIN_VALUE;
System.out.println("Integer 区间为 [" + min +" ~ "+ max +"]" );
String stringTest = new String("abc,def,gd");
int length = stringTest.length();
int first = stringTest.indexOf("d");
int last = stringTest.lastIndexOf("d");
String[] split = stringTest.split(",");
System.out.println("字符串长度为: "+length);
System.out.println("字母d第一次出现的下标为 : "+first);
System.out.println("字母d最后一次出现的下标为 : "+last);
System.out.print("字符串分隔成数组: [");
for (int i = 0; i < split.length; i++) {
if (i!=split.length-1){
System.out.print(split[i] +",");
}else {
System.out.print(split[i] +"]");
}
}
}