public class three{
public static void main(String[] args){
byte a=1;
//最小
short b=20;
int c=30;
//int为常用
long d=50l;
//long结尾加l
float num1=1.66f;
//float结尾加f
double num2=33.1523;
char na='嗨';
//单字符
String num4="小呆";
//字符串
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(num1);
System.out.println(na);
System.out.println(num4);
System.out.printf("%.2f",num2);
//取小数点后两位
//数值转换用printf
//注释编译不通过:javac -encoding UTF-8 three.java
}
}
HHH~