IntelliJ IDEA之常用模板

 1 public class templateTest {
 2     //模板一:psvm
 3     public static void main(String[] args) {
 4 
 5         //模板二:sout
 6         System.out.println("Hello!");
 7         //模板二的变形:soutp/soutm/souv/xxx.sout
 8         System.out.println("templateTest.main");
 9         System.out.println("args = " + args);
10         int num1 = 10;
11         System.out.println(num1);
12 
13         //模板三:fori
14         String[] arrays = new String[]{"Jacob", "Lee"};
15         for (int i = 0; i < arrays.length; i++) {
16             System.out.println(arrays[i]);
17         }
18         //变形:iter
19         for (String array : arrays) {
20             System.out.println(array);
21         }
22         //变形:itar
23         for (int i = 0; i < arrays.length; i++) {
24             String array = arrays[i];
25         }
26 
27         //模板四:array.for
28         ArrayList<Integer> array = new ArrayList<>();
29         array.add(12);
30         array.add(34);
31         array.add(56);
32 
33         for (Integer integer : array) {
34         }
35 
36         //变形:array.fori (正序遍历)
37         for (int i = 0; i < array.size(); i++) {
38 
39         }
40 
41         //变形:array.forr(倒序遍历)
42         for (int i = array.size() - 1; i >= 0; i--) {
43 
44         }
45 
46         //模板五:ifn
47         ArrayList<Integer> list = new ArrayList<>();
48         list.add(12);
49         list.add(34);
50         list.add(56);
51         if (list == null) {
52 
53         }
54 
55         //变形:inn
56         if (list != null) {
57 
58         }
59 
60         //变形:xxx.nn/xxx.null
61         if (list != null) {
62 
63         }
64 
65         if (list == null) {
66 
67         }
68     }
69 
70     //模板六:prsf
71     private static final int n= 3;
72 }

 

posted @ 2020-06-02 14:51  Student-JacobLee  阅读(645)  评论(0编辑  收藏  举报