应用代码
/** * 类的说明 * @author Administrator作者 * */ public class hello { /** * 这是主方法,是程序的入口 * @param args输入参数,字符串类型的数组 */ public static void main(String[] args) { //关键代码: //注释 System.out.println("hello world"); String dd123 = "";//定义变量 int i; i = 123; int m = 1,n = 2,x = 4,y = 5; final double PAI = 3.14; //pai = 3.1415926 //i = "ddd"; String strUserName = "tom住在这个房间里"; System.out.println(strUserName); strUserName = "张三住在这里"; System.out.println(strUserName); System.out.println(x); byte b = -128; short s = 2; int j = 123; int l =(int) 1234L;//强制转换,显示转换 long ll = b; float f = 123.45F; double d = 123.45D; f = (float)d; f = ll; char c = 'a'; int a = c; System.out.println("a = " + a); char g = 98; System.out.println("g = " + g);//ASCII码 //UTF-8(JAVA 应用) boolean t = true; //逻辑真 t = false; //逻辑假 } }