Java零碎操作

來源:互聯網
上載者:User

標籤:尋找   pac   junit   自訂   編碼   類載入   []   檔案   tar   

快速鍵:

window --> preferences --> kekys:自訂快速鍵
1.alt + /:內容提示
2.Ctrl + 1:快速修複
3.Ctrl + shift + O:導包
4.alt + 方向鍵:向前向後,查看源碼時候用到
5.ctrl + shift + /:添加前注釋
6.ctrl + shift + \:除去注釋
7.ctrl + shift + F:內容格式
8.ctrl + shift + x:更改為大寫
9.ctrl + shift + y:更改為小寫
10.ctrl + alt + 向下鍵:複製一行代碼
11.alt + 向上向下鍵:行動程式碼
12.ctrl + t:查看類的繼承關係
13.ctrl + shift + t:查看原始碼
14.ctrl + shift + l:查看所有快速鍵
15.ctrl + h:尋找單詞

 

修改編碼格式:

1.window --> preferences --> general --> workspace -->text file encoding:整個軟體
2.alt+斷行符號:單個java檔案修改編碼格式

 

重設視窗:

window --> reset perspective

 

junit:
@Test:使用junit測試類別
@Before:測試方法運行前初始設定變數
@After:方法結束後釋放資源
@BeforeClass:類載入的時候就初始化
@AfterClass:
before --> run --> afer --> before --> eat --> after
beforeClass --> run --> eat --> afterClass

 

Assert:斷言
Assert.assertEquals("1",p.run()) --> 測試run()方法,期待返回1
Assert.assertArrayEquals(new int[]{1,1},new int[]{1,2}) --> 判斷兩個數組是否相等

Java零碎操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.