标签:
package javafirst;//包名 public class JavaFirstDay { //基本数据类型的练习 public static void main(String[] args) { byte byteOne = 125; short shortOne = 12345; int intOne = 2345; long longOne = 123l;//默认为int float floatOne = 12.3f;//默认为double double doubleOne = 12.3; //char变量赋值的三种形式 char charOne = ‘z‘; char charTwo = ‘中‘; char charThree = 99; boolean isBool = false;//布尔型 final int finalInt = 12;//常量 System.out.println("byteOne = "+byteOne); System.out.println("shortOne + 123 = "+ (shortOne + 123));//带括号转变为算术 System.out.println("shortOne123 = " + shortOne + 123);//不带括号作为字符串连接 System.out.print("intOne + 123 = "); System.out.println(intOne + 123);//无字符串连接为算术运算 System.out.print("charThree = "+charThree+"\n换行符的练习");//转义字符 } }
标签:
原文地址:http://www.cnblogs.com/whytohow/p/4845133.html