04 2024 档案
摘要:for循环: public class For { public static void main(String[] args) { int sum = 0; for (int i = 1 ; i <= 100 ; i++){ if (i % 2 ==0){ sum = sum + i; } } S
阅读全文
摘要:三元运算符: public static void main(String[] args) { int p1 = 150; int p2 = 210; int p3 = 165; int max = p1 > p2 ? p1 : p2; int max2 = max > p3 ? max : p3;
阅读全文
摘要:隐式转换 1、byte<short<int<long<float<double 2、计算时,byte,short,char转换为int类型。 3、小的和大的一起计算,转换为大的。
阅读全文