摘要: public class Demo08 { // final static double PI = 3.14; public static void main(String[] args) { System.out.println(PI); }} 阅读全文
posted @ 2021-09-16 18:11 山城旧客 阅读(28) 评论(0) 推荐(0)
摘要: public class Demo06 { public static void main(String[] args) { //int a=1,b=2,c=3;//程序可读性 String s = "jiangmu"; char m = 21; double n = 873; }} 阅读全文
posted @ 2021-09-16 18:10 山城旧客 阅读(30) 评论(0) 推荐(0)
摘要: public class Demo07 { ////类变量 static static double salary = 2500; //属性 变量 //实例变量;从属于对象;如果不自行初始化,这个类型的默认值,0 0.0 //布尔值:默认是false //除了基本类型,除了默认值都是null Str 阅读全文
posted @ 2021-09-16 18:09 山城旧客 阅读(31) 评论(0) 推荐(0)
摘要: public class Demo05 { public static void main(String[] args) { int money = 10_0000_0000; System.out.println(money); int years = 20; int total = money* 阅读全文
posted @ 2021-09-15 19:02 山城旧客 阅读(26) 评论(0) 推荐(0)
摘要: public class Demo04 { public static void main(String[] args) { int i = 128 ; byte d = (byte) i;//内存溢出 //强制转换 (类型)变量名 由高到低 //自动转换 由低到高 System.out.print 阅读全文
posted @ 2021-09-15 19:01 山城旧客 阅读(34) 评论(0) 推荐(0)
摘要: public class Demo03 { public static void main(String[] args) { //整数拓展 :进制 二进制0b 十进制 八进制 0 十六进制 0x int i = 10; int i2 = 010;//八进制0 int i3 = 0x11;//十六进制 阅读全文
posted @ 2021-09-12 20:27 山城旧客 阅读(54) 评论(0) 推荐(0)
摘要: public class Demo02 { public static void main(String[] args) { //八大基本数据类型 //整数类型 int num1 = 10;//最常用 byte num2 = 20; short num3 = 30; long num4 = 40L; 阅读全文
posted @ 2021-09-12 20:26 山城旧客 阅读(43) 评论(0) 推荐(0)
摘要: public class Demo01 { public static void main(String[] args) { String Ahello="jiamgmu"; String ahello="jiamgmu"; String $hello="jiamgmu"; String _hell 阅读全文
posted @ 2021-09-12 20:25 山城旧客 阅读(37) 评论(0) 推荐(0)
摘要: public class Helloworld { public static void main(String[] args) { //单行注释可以注释一行文字 //输出一个Hello,world! System.out.println("Hello,World"); }}//多行注释/**/ / 阅读全文
posted @ 2021-09-10 18:46 山城旧客 阅读(62) 评论(0) 推荐(0)
摘要: Hello World 随便新建一个文件夹,将存放代码 新建一个Java文件 文件后缀名为.java hello.java 注意系统可能没有显示文件后缀名字,需要手动打开 编写代码 public class Hello{ public static void main(String[] args){ 阅读全文
posted @ 2021-08-23 20:06 山城旧客 阅读(36) 评论(0) 推荐(0)