IDEA常用的模板

模板一 (主函数) : psvm 或 main

	public static void main(String[] args) {
    
    }

模板二 (打印输出) : sout

	System.out.println();

变形1 : soutp

	public static void main(String[] args) {
       System.out.println("args = " + Arrays.deepToString(args));
    }

变形2 : soutm

	public static void main(String[] args) {
    	  System.out.println("AuthFilter.main");
	}

变形3 : soutv

	public static void main(String[] args) {
    	int num = 1;
        System.out.println("num = " + num);
   }

变形4 : xxx.sout (“xxx” 为 要打印的变量等等 , 比如 : num.sout)

	public static void main(String[] args) {
	   	   int num = 1;
	   	   System.out.println(num);
	}

模板三 (循环遍历): fori

	public static void main(String[] args) {
	   	String[] str = new String[]{"a","b","c"};
	   	for (int i = 0; i < ; i++) {
	       
	    }
	}

变形1 : iter

	public static void main(String[] args) {
		String[] str = new String[]{"a","b","c"};
		for (String s : str) {
	 
		}
	}

变形2 : itar

	public static void main(String[] args) {
    	  String[] str = new String[]{"a","b","c"};
    	  for (int i = 0; i < str.length; i++) {
          String s = str[i];
        
    	  }
	}

变形3 : xxx.for (“xxx” 为 要遍历的集合 , 比如 : list .for)

	public static void main(String[] args) {
   	   List<SysDepartment> list = new ArrayList<>();
   	   for (SysDepartment department : list) {
	
	   }
	}

变形4 : xxx.fori (“xxx” 为 要遍历的集合 , 比如 : list .fori ) , 顺序遍历

	public static void main(String[] args) {
	  	 List<SysDepartment> list = new ArrayList<>();
	     for (int i = 0; i < list.size(); i++) {
	      
	  	 }
	}

变形5 : xxx.forr (“xxx” 为 要遍历的集合 , 比如 : list .forr) , 倒序遍历

	public static void main(String[] args) {
	  	 List<SysDepartment> list = new ArrayList<>();
	     for (int i = list.size() - 1; i >= 0; i--) {
	   
	   }
	}

模板四 (条件判断) : ifn

	public static void main(String[] args) {
       String str = null;
       if (str == null) {
        
       }
    }

变形1 : inn

	public static void main(String[] args) {
   	   String str = null;
   	   if (str != null) {
       
       }
   	}

变形2 : xxx.nn (“xxx” 为 要判断的变量 , 比如 : str.nn)

	public static void main(String[] args) {
   	    String str = null;
   	    if (str != null) {
     
    	}
  	}

变形3 : xxx.null (“xxx” 为 要判断的变量 , 比如 : str.null)

	public static void main(String[] args) {
      	String str = null;
      	if (str == null) {
       
      	}
   	}

模板五 ( 生成 private static final 定义私有的静态的常量 ) : prsf

	private static final

同类型1 : psf ( 生成 public static final 定义公共的静态的常量 )

	public static final

变形1 : psfi

	public static final int

变形2 : psfs

	public static final String

也可以自己定义模板…

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值