📄 for5.java
字号:
/**
* 数组循环
*/
public class For5{
public static void main(String[] args){
arrayLoopRefactoring_1();
System.out.println("-----------");
arrayLoopRefactoring_2();
System.out.println("-----------");
}
//
public static void arrayLoopRefactoring_1(){
int[] myArray = {1 , 2 , 3 , 4} ;
for(int x = 0;x<myArray.length;x++) {
System.out.println(myArray[x]);
}
}
//1.5
public static void arrayLoopRefactoring_2(){
int[] myArray = {1,2,3,4};
for(int item:myArray) {
System.out.println(item);
}
String[] lst={"你好","ok","hello"};
for(String s:lst){
System.out.println (s);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -