本帖最後由 蔡庭豪 於 2018-3-17 11:18 編輯
- package bbs.istak.org.tw;
- public class Test {
- public int score;
- public String name;
-
- public Test(int score , String name){
-
- this.score = score;
- this.name = name;
- }
-
- public void getifm(){
-
- System.out.println("Hello! my name is "+this.name+",and I got "+this.score+" in this test.");
-
- }
- }
複製代碼- package bbs.istak.org.tw;
- public class Main {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- Test tt = new Test(95,"Frank");
- tt.getifm();
- }
- }
複製代碼 |