例3.1
class DataDemo01{
public static void main(String[] args){
int num=9999999999999999999999999;
}
}
例3.2
class DataDemo02{
public static void main(String[] args){
int max=2147483647;
System.out.println("整型的最大值:"+max);
System.out.println("整型最大值+1:"+(max+1));
System.out.println("整型最大值+2:"+(max+2));
}
}
例3.3
class DataDemo03{
public static void main(String[] args){
int max=2147483647;
System.out.println("整型的最大值:"+max);
System.out.println("整型最大值+1:"+(max+1));
System.out.println("整型最大值+2:"+(max+2L));
System.out.println("整型最大值+2:"+((long)max+2));
}
}
例3.4
class DataDemo04{
public static void main(String[] args){
char ch1=‘a‘;
char ch2=97;
System.out.println("ch1="+ch1);
System.out.println("ch2="+ch2);
}
}
例3.5
class DataDemo05{
public static void main(String[] args){
char ch1=‘\"‘;
char ch2=‘\\‘;
System.out.println("ch1="+ch1);
System.out.println("ch2="+ch2);
System.out.println("\"Hello World\"");
}
}
例3.6
class DataDemo06{
public static void main(String[] args){
float num=3.0f;
System.out.println("两个小数相乘:"+num*num);
}
}
例3.7
class DataDemo07{
public static void main(String[] args){
boolean flag=true;
System.out.println("flag="+flag);
}
}
原文:http://www.cnblogs.com/chasingli/p/5363052.html