每日学习java笔记20090301

Char 型
    char a = 'a';
    char b = 'b';
    char c = '诸';
    char d = '葛';
    System.out.println(a+"_"+b+"_"+c+"_"+d);
    结果为:  a_b_诸_葛
   

   byte e = 123;
   short h = e;
   byte j = (byte)h;
   System.out.println(e+"_"+h+"_"+j);
   
   int g = 8<<2;( 位运算与乘2的n次方效果相同,通常在开发中很多情况下,用左移代替以2的n次方)
   System.out.println(g);  结果为: 16


   int i = 88>>32;  //88
   long l = 67<<64;  //67
   System.out.println(i);
   System.out.println(l);

   
   //abs() 绝对值
     int i = Math.abs(50); //50 
     long l = Math.abs(-50L); //-50
     float f = Math.abs(20.0f); //20.0
     double d = Math.abs(34.55); //34.55

int i = 2;
	  switch(i){
	     case 1:
		       System.out.println("这是1");
		        break;
	     case 2:
		        System.out.println("这是2");
		        break;
	     default:
		        System.out.println("没有找找到");
	  }

你可能感兴趣的:(java,C++,c,C#,J#)