/*多行注释的快捷键:Ctrl+shift+/
快速格式化代码快捷键:Ctrl+shift+f
自动导入一个包:Ctrl+shift+o
*/
package test_1;public class Day_2 {public static void main(String args[]) {//一个九九乘法表的实现int c = 0;for (int a = 1; a <= 9; a++) {for (int b = 1; b <= a; b++) {c = a * b;System.out.printf("%d*%d=%d ",b,a,c);}System.out.println();}System.out.println("-------------------我是华丽的分割线--------------------------");// 遍历数组的方法// 方法1:int arr[] = new int[3];for (int a = 0; a < arr.length; a++) {System.out.println(arr[a]);}System.out.println("-------------------我是华丽的分割线--------------------------");//方法2:for (int a : arr) {System.out.println(a);}System.out.println("-------------------我是华丽的分割线--------------------------");//二维数组的遍历int arr2[][]=new int[][]{{1,2,3},{4,5,6},{7,8,9}};for(int i=0;i<arr2.length;i++){for(int j=0;j<arr2[0].length;j++){System.out.print(arr2[i][j]+" "); }System.out.println();}}}
转载于:https://www.cnblogs.com/hwtblog/articles/8322133.html