{{{ // 存為 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()); } } }}} }}}