1. 程式人生 > >idea 生成常用程式碼快捷方法

idea 生成常用程式碼快捷方法

生成常用程式碼快捷方法

psvm 生成main 方法

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

psf 生成公共靜態final

public static final 

psfi 生成公共靜態 final int

public static final int 

psfs 生成公共靜態final String

public static final String 

sout 生成控制檯輸出

System.out.println();

itar 生成array for程式碼塊

for (int i = 0; i < array.length; i++) {
	String tmp = array[i];
}

itco 生成Collection迭代

for (Iterator<String> iterator = locationUrl.iterator(); iterator.hasNext(); ) {
	String next =  iterator.next();      
}

iten 生成enumeration遍歷

while (enumeration.hasMoreElements()) {
	Object nextElement =  enumeration.nextElement();
}

iter 生成增強forxun

for (String s : locationUrl) {
            
}

itit 生成iterator 迭代

while (iterator.hasNext()) {
	Object next =  iterator.next();
}

itli 生成List的遍歷

for (int i = 0; i < locationUrl.size(); i++) {
	String s =  locationUrl.get(i);
} 

ittok 生成String token遍歷

for (StringTokenizer stringTokenizer = new StringTokenizer(TVSOU_URL); stringTokenizer.hasMoreTokens(); ) {
	String s = stringTokenizer.nextToken();    
}

10.fori 生成遞增迴圈

for (int i = 0; i < 10; i++) {
   
}

10.forr 生成遞減迴圈

  for (int i = 10; i > 0; i--) {
      
  }

itve 生成Vector陣列迭代

for (int i = 0; i < vector.size(); i++) {
	Object elementAt =  vector.elementAt(i);
 }

itaws 生成Axis2 web service呼叫

try {
	MyServiceStub stub = new MyServiceStub();
	stub.sayHelloWorldFrom();
 } catch (Exception ex) {
	ex.printStackTrace();
 }

itws 生成 Axis web service呼叫

try {
     MyServiceLocator locator = new MyServiceLocator();
     Activator service = locator.get();
     // If authorization is required
     //((MyService_Soap_BindingStub)service).setUsername("user3");
     //((MyService_Soap_BindingStub)service).setPassword("pass3");
     // invoke business method
     service.businessMethod();
 } catch (javax.xml.rpc.ServiceException ex) {
     ex.printStackTrace();
 } catch (java.rmi.RemoteException ex) {
     ex.printStackTrace();
 }

String 型別

“test”.sout //輸出

System.out.println("test");

“test”.cast //轉換

((游標位置) "test")

“test”.format //字串格式化

String.format("test", 游標位置)

“test”.inst 或者 “test”.instanceof

"test" instanceof  ? ((游標位置) "test") : null;

“test”.nn 或者 “test”.notnull

if ("test" != null) {
    
}

“test”.null

if ("test" == null) {
    
}

“test”.par

("test")

“test”.return

return "test";

“test”.synchronized

synchronized ("test") {
    
}

“test”.try

try {
    "test"
} catch (Exception e) {
    e.printStackTrace();
}

“test”.var

String test = "test";

boolean型別

true.  自動聯想N多快捷方法

數值型別

int a = 2;
a. 自動聯想N多快捷方法,包括迴圈