摘要:
int i = 0; do { System.out.println(i); i++; } while (i < 5); // Outputs 0 1 2 3 4 At least it will invoke 1 time the code inside of "do" int i = 0; do 阅读全文
posted @ 2022-11-24 03:57
小白冲冲
阅读(34)
评论(0)
推荐(0)
摘要:
Instead of writing many if..else statements, you can use the switch statement. int day = 4; switch (day) { // every case will be a posibility of "day" 阅读全文
posted @ 2022-11-24 03:39
小白冲冲
阅读(96)
评论(0)
推荐(0)
摘要:
Math.max(5, 10); // Outputs 10 Math.min(5, 10); // Outputs 5 Math.sqrt(64); // Outputs 8.0 Math.abs(-4.7); // Outputs 4.7 Math.random(); // returns a 阅读全文
posted @ 2022-11-24 03:28
小白冲冲
阅读(22)
评论(0)
推荐(0)
摘要:
String Methods: String txt = "Hello World"; System.out.println(txt.toUpperCase()); // Outputs "HELLO WORLD" System.out.println(txt.toLowerCase()); // 阅读全文
posted @ 2022-11-24 03:17
小白冲冲
阅读(38)
评论(0)
推荐(0)
摘要:
In Java, there are two types of casting: Widening Casting (automatically) - converting a smaller type to a larger type sizebyte -> short -> char -> in 阅读全文
posted @ 2022-11-24 02:38
小白冲冲
阅读(18)
评论(0)
推荐(0)
摘要:
Primitive types are predefined (already defined) in Java. Non-primitive types are created by the programmer and is not defined by Java (except for Str 阅读全文
posted @ 2022-11-24 02:28
小白冲冲
阅读(89)
评论(0)
推荐(0)
摘要:
Example Instead of writing: int x = 5; int y = 6; int z = 50; System.out.println(x + y + z); You can simply write: int x = 5, y = 6, z = 50; System.ou 阅读全文
posted @ 2022-11-24 02:16
小白冲冲
阅读(28)
评论(0)
推荐(0)

浙公网安备 33010602011771号