package practice;
import java.util.Date;
public class Learn {
public static void main(String[] args) {
char a[]={'A','B','C'};
String s=new String(a);
System.out.println(s);
int i=Integer.parseInt("1");
System.out.println(i);
double j=Double.parseDouble("12");
System.out.println(j);
double h=new Integer("56789").doubleValue();
System.out.println(h);
Integer h1=new Integer("56789").intValue();
System.out.println(h1.toString());
Integer l1=10;
int l2=l1;
Integer l3=10;
System.out.println(l3+10);
System.out.println(l3++);
Boolean l4=true;
Boolean l5=false;
System.out.println(l4&&false);
System.out.println(l4&&l5);
int l6=7;
Integer l7=l6;
Number l8=250.0f;
System.out.println(l1.doubleValue()/4);
int y1=8;
String y2=String.valueOf(y1);
System.out.println(y2);
double y3=8.88;
String y4=String.valueOf(y3);
System.out.println(y4);
System.out.println(new Date().toString());
int f1=100;
int f2=101;
System.out.println(i==j);
String f3="hahaha";
String f4="hahaha";
String f5=new String("hahaha");
System.out.println(f3==f4);
System.out.println(f4==f5);
System.out.println(f4.equals(f5));
String f6="HAHAHA";
System.out.println(f3.equalsIgnoreCase(f6));
System.out.println("ABC".compareTo("ABE"));
System.out.println("ABCde".compareTo("ABc"));
System.out.println(("woshilyf~").startsWith("wo"));
System.out.println(("woshilyf~").startsWith("lyf~"));
System.out.println(("woshilyf~").indexOf("wo"));
System.out.println(("woshilyf~woshilyf~").indexOf("wo",2));
System.out.println(("woshilyf~woshilyf~").lastIndexOf("lyf"));
System.out.println(("woshilyf~woshilyf~").lastIndexOf("lyf",5));
System.out.println(" C A ".trim()+"B");
String ch="hello worldhe lloworld";
int x;
StringBuffer ch1=new StringBuffer();
for(x=0;x<ch.length();x++){
char y=ch.charAt(x);
if(y!=' '){
ch1.append(y);
}
}
System.out.println(ch1);
String p="helloWorld";
System.out.println(p.substring(0,4));
String ss[]="a=b=c=d".split("=");
System.out.println(ss[0]+"--"+ss[1]+"--"+ss[2]+"--"+ss[3]);
String ll[]="haha%ni/hao".split("%");
System.out.println(ll[0]+"---"+ll[1].split("/")[1]);
}
}
基本数据类型对应的包装类
基本 包装
boolean Boolean
byte Byte
char Character
short Short
int Integer
long Long
float Float
double Double