摘要: public class Demon10 { //类变量 static static double salary = 2500; //属性:变量 //实例变量:从属于对象;如果不自行初始化,则输出这个类型的默认值0、0.0 //布尔值默认false //除了基本类型,其余的默认值都是full; St 阅读全文
posted @ 2021-08-18 21:41 小风扇呜呜呜 阅读(12) 评论(0) 推荐(0)
摘要: public class Demon09 {//定义常量static修饰符,不分先后顺序。 static final double Pi = 3.14; public static void main(String[] args) { System.out.println(Pi); }}输出: 3. 阅读全文
posted @ 2021-08-18 21:28 小风扇呜呜呜 阅读(40) 评论(0) 推荐(0)
摘要: public class Demo06 { public static void main(String[] args) { int i = 128; double b = i; //强制转换: (类型)变量名 高——底 //自动转换: 底——高 System.out.println(i); Sys 阅读全文
posted @ 2021-08-18 20:40 小风扇呜呜呜 阅读(33) 评论(0) 推荐(0)
摘要: public class BeerSong { public static void main(String[] args) { int beerNum = 99; String word = "bottles"; while (beerNum > 0) { if (beerNum == 1) { 阅读全文
posted @ 2021-08-18 16:36 小风扇呜呜呜 阅读(65) 评论(0) 推荐(0)
摘要: public class IfTest2 { public static void main(String[] args) { int x = 2; if (x == 3) { System.out.println("x must be 3"); } else { System.out.printl 阅读全文
posted @ 2021-08-18 15:56 小风扇呜呜呜 阅读(17) 评论(0) 推荐(0)
摘要: public class Loopy { public static void main(String[] args) { int x = 1; System.out.println("Before the Loop"); while (x<4) { System.out.println("In t 阅读全文
posted @ 2021-08-18 15:43 小风扇呜呜呜 阅读(39) 评论(0) 推荐(0)