返回列表 發帖
  1. package bbs.istak.org.tw;

  2. public class Main {

  3.         public static void main(String[] args) {
  4.                 // TODO 自動產生的方法 Stub
  5.                 Student stu = new Student("plan",100000);
  6.                 stu.getstudent();
  7.         }

  8. }
複製代碼
  1. package bbs.istak.org.tw;

  2. public class Student {
  3.         public String name;
  4.         public int score;
  5.         public Student(String name,int score)
  6.         {
  7.                 this.name = name;
  8.                 this.score = score;
  9.         }
  10.         public void getstudent()
  11.         {
  12.                 System.out.println("I'm student "+this.name+".My score is"+this.score);
  13.         }
  14. }
複製代碼

TOP

返回列表