Changes between Version 6 and Version 7 of Java_Lab1
- Timestamp:
- May 1, 2010, 10:08:09 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Java_Lab1
v6 v7 2 2 3 3 * 實驗環境:請至 http://hadoop.nchc.org.tw 申請帳號,並用網頁帳號登入系統,或用 SSH 系統帳號登入系統。 4 * 註:Windows 操作請參考[grid:wiki:jazz/09-07-06 2009-07-06 成大工科實習生 Java 教學(一)] 4 5 5 6 = 練習一: 基本爪哇程式編譯指令與執行方法 = … … 30 31 System.out.println("Hello World!"); 31 32 }}} 32 * 註:Windows 操作請參考[grid:wiki:jazz/09-07-06 2009-07-06 成大工科實習生 Java 教學(一)]33 33 34 34 = 慢慢長大的類別 == 35 35 36 * 36 * 讓我們來設計一個複雜一點的類別, 37 {{{ 38 #!sh 39 hadoop004@hadoop:~$ cat > Test.java <<EOF 40 import java.io.*; 41 import java.lang.String; 42 43 public class Test 44 { 45 public String myData; 46 47 public String getMyData() 48 { 49 return myData; 50 } 51 52 public void setMyData(String data) 53 { 54 myData = new String(data); 55 } 56 57 public static void main(String args[]) { 58 Test myTest = new Test(); 59 myTest.setMyData("This is a test"); 60 System.out.print(myTest.getMyData()); 61 } 62 } 63 EOF 64 }}}