上机的时候发生意外,机子重启了,所以只写了一个程序,其次,后面的程序也不是很会写,这就是我只提交一个程序的理由;
package bbb;
public class person {
String name;
int age;
public person(String name,int age){
this.name=name;
this.age=age;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public int getAge(){
return age;
}
public void setAge(int age){
this.age=age;
}
void print(){
System.out.println("名字: "+name+"
"+"年龄: "+age);
}
}
package bbb;
public class Testperson {
public static void main(String[] args){
person p1=new person("橙子",18);
p1.print();
}
}