Java-basic-1

來源:互聯網
上載者:User

標籤:pager   hello   device   method   開始   translate   首字母   byte   執行個體   

1.

Java Standard Edition (Java SE) 

Java Enterprise Edition (Java EE):

geared toward developing large-scale, distributed networking applications and web-based applications
Java Micro Edition (Java ME):
geared toward developing applications for small, memory-constrained devices, such as cell phones, pagers and PDAs.

2. Javadoc comments:

使用/**開始,*/結束;javadoc utility program 讀Javadoc來做html文檔

3. implicitly imports java.lang,所以不用寫

4.

類的命名:每個詞的首字母大寫:ClassName,不能以數字開頭

變數和函數的命名:首詞首字母小寫,其他首字母大寫:variName

5. 

// turn into .class containing Java bytecodes
javac fileName.java
// javac *.java多個java檔案同時編譯
// translated by JVM for os, execute
java fileName

6. Integer division: 小數部分直接拋棄

7. static method:
不需要建立其執行個體就可以用。main是static的,而且每個class裡都可以有一個main,具體用哪個根據java命令來定。

8.

primitive types:
boolean, byte, char, short, int, long, float, double
reference types:
Objects that are referenced may each contain many instance variables and methods. 不是primitive,就是reference。

 

下面是代碼時間:) 

// for dialog windowimport javax.swing.JOptionPane;//Only ONE publicpublic class test {public static void main(String[] args) {// Standard output object. to command lineSystem.out.print("first");// add /nSystem.out.println("Hello world!");// format-controlfloat i = 3.2f;System.out.printf("%s\n%.2f", "Hello", i);// input dialog window. get input.String name = JOptionPane.showInputDialog("what‘s your name?");// format control of stringString msg = String.format("Welcome, %s", name);// first: position of window. null = centerJOptionPane.showMessageDialog(null, msg);}}

  

Java-basic-1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.