Version 6 (modified by jazz, 15 years ago) (diff) |
---|
2009-07-07
- 成大工科實習生
- Part 1 : Java 多個類別的寫法
// 存為 Test.java import java.io.*; import java.lang.String; public class Test { public String myData; public String getMyData() { return myData; } public void setMyData(String data) { myData = new String(data); } public static void main(String args[]) { System.out.print("args.length=" + args.length); System.out.print("\n"); if(args.length < 2) { System.out.print("Usgage: java Test myData myWeight"); System.exit(1); } Test myTest = new Test(); myClass myclass = new myClass(); myTest.setMyData(args[0]); System.out.print(myTest.getMyData()); System.out.print("\n"); System.out.print(myclass.getWeight()); System.out.print("\n"); myclass.setWeight(args[1]); System.out.print(myclass.getWeight()); } }
public class myClass { public String myWeight; public String getWeight() { return myWeight; } public void setWeight(String weight) { myWeight = new String(weight); } public myClass() { setWeight("50"); } public static void main(String args[]) { myClass myclass = new myClass(); System.out.print(myclass.getWeight()); } }
- Part 1 : Java 多個類別的寫法
- Part 2 : Linux 安裝
- 2008 陽明大學 格網與叢集運算 課程 - 用 7-zip 解開至硬碟 或用 Daemon Tools 虛擬成光碟。
- 記得確認複製或解壓縮出來的目錄取消"唯讀"權限
Attachments (1)
- HomeWork.png (13.4 KB) - added by jazz 15 years ago.
Download all attachments as: .zip