6

 1 //程序员:马相露
 2   import java.util.Scanner;
 3   public class L {
 4   
 5       public static void main(String[] args) {
 6           long a ;                //练习题1:输出一个长整型的变量 123456789012345
 7           a=123456789012345l;
 8           System.out.println(a);
 9           
10          float b=2.4f;            //练习题2:输出一个单精度的小数常量 2.4
11          System.out.println(b);
12            
13          boolean c=true;            //练习题3:输出一个布尔类型的变量
14          System.out.println(c);
15          c=false;
16          System.out.println(c);    
17             
18          byte d=3;                //练习题4:强制类型转换
19          d=(byte)(d+200);
20          System.out.println(d);    
21               
22          System.out.println((char)('a'+1));//练习题5:输出1个字符型的加法计算
23          System.out.println((char)(''+1));
24                  
25          int e=Integer.MAX_VALUE+1;        //练习题6:int 也对应着一个类,Integer 演示变量的溢出效果
26          System.out.println(e);
27                  
28          @SuppressWarnings("resource")      //练习题7:算术运算符+-*/
29          Scanner input=new Scanner(System.in);
30          double f;
31          System.out.println("Enter the x ");
32          f = Double.valueOf(input.nextDouble());
33          f=f/1000*1000;
34          System.out.println("The calculation result is " + f);
35          }
36  
37  }

 

posted @ 2017-12-18 14:15  mxl-1  阅读(126)  评论(0编辑  收藏  举报