public class People {
private String Name;
private int age;
public void Introduce(){
System.out.println("大家好!我叫"+Name + ",今年"+age+"歲");
}
public People(String name, int age) {
Name = name;
this.age = age;
public String getName() {
return Name;
public void setName(String name) {
public int getAge() {
return age;
public void setAge(int age) {
public class PeopleInstance {
public static void main(String[] args) {
People pe1 = new People("小強",21);
People pe2 = new People("寶寶",22);
pe1.Introduce();
pe2.Introduce();
public class People {
private String Name;
private int age;
public void Introduce(){
System.out.println("大家好!我叫"+Name + ",今年"+age+"歲");
}
public People(String name, int age) {
Name = name;
this.age = age;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
public class PeopleInstance {
public static void main(String[] args) {
People pe1 = new People("小強",21);
People pe2 = new People("寶寶",22);
pe1.Introduce();
pe2.Introduce();
}
}