摘要: 二维数组 可以理解为一个数组里面嵌套了另一个数组 如何程序的概念都应该在程序中体现和分析 package reck;​public class Demo03 { public static void main(String[] args) { /* 动态的表示 */ int[][] a=new in 阅读全文
posted @ 2021-03-09 20:43 默默努力的路人甲 阅读(71) 评论(0) 推荐(0)
摘要: Java数组的进阶 求数组中的最大值 package reck;​public class Demo02 { public static void main(String[] args) { //求数组中的最大值 int[] num={1,2,3,4,5}; int max = 0;//先定义一个值 阅读全文
posted @ 2021-03-09 14:43 默默努力的路人甲 阅读(131) 评论(0) 推荐(0)
摘要: package reck;​public class Demo01 { public static void main(String[] args) { //创建之后直接赋值 int[] a = {1,2,3,4,5};​ System.out.println(a[2]); int[] b=new 阅读全文
posted @ 2021-03-08 20:04 默默努力的路人甲 阅读(46) 评论(0) 推荐(0)
摘要: Java的数组 public class Demo18 { public static void main(String[] args) { int[] nums;//1.声明一个数组 nums = new int[5];//2.创建一个为5的数组 //通常可以合为一步 int[] nums = n 阅读全文
posted @ 2021-03-08 12:41 默默努力的路人甲 阅读(33) 评论(0) 推荐(0)
摘要: Java的递归 public class Demo17 { public static void main(String[] args) { //阶乘的计算 System.out.println(f(10)); } public static int f(int a){ if (a==1){ ret 阅读全文
posted @ 2021-03-07 16:06 默默努力的路人甲 阅读(27) 评论(0) 推荐(0)
摘要: Java的可变参数 public class Demo16 { public static void main(String[] args) { Demo16 demo16 = new Demo16();//调用与实例变量调用一样 //因为test没有static所以不能直接调用 demo16.te 阅读全文
posted @ 2021-03-07 10:11 默默努力的路人甲 阅读(25) 评论(0) 推荐(0)
摘要: Java方法的重载 方法重载:在类中方法名称相同,但是形式参数不同 public class Demo15 { public static void main(String[] args) { int sum= max(30,30); System.out.println(sum); double 阅读全文
posted @ 2021-03-07 08:54 默默努力的路人甲 阅读(98) 评论(0) 推荐(0)
摘要: Java的方法 public class Demo14 { public static void main(String[] args) { int sum=add(1,2);//方法的调用 //实际参数 System.out.println(sum);​ } //形式参数 public stati 阅读全文
posted @ 2021-03-06 13:37 默默努力的路人甲 阅读(28) 评论(0) 推荐(0)
摘要: 利用循环打印出三角形 public class Demo13 { public static void main(String[] args) { for (int i = 1; i <=5; i++) { for (int d = 5;d>=i;d--){ System.out.print(" " 阅读全文
posted @ 2021-03-05 18:09 默默努力的路人甲 阅读(61) 评论(0) 推荐(0)
摘要: break public class Demo12 { public static void main(String[] args) { int i = 0; while (i<100){ i++; if (i==30){ break;//直接终止循环 } System.out.println(i) 阅读全文
posted @ 2021-03-05 17:51 默默努力的路人甲 阅读(50) 评论(0) 推荐(0)