package disizhang;
public class people {
String name;
String sex;
int age;
void getInfo(String a,String b,int c) {
name=a;
sex=b;
age=c;
}
void showInfo() {
System.out.println(“姓名:”+name);
System.out.println(“性别:”+sex);
System.out.println(“年龄:”+age);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
people zhangsan=new people();
System.out.println(“请输入第一个人的信息”);
zhangsan.name=”张三”;
zhangsan.sex=”男”;
zhangsan.age=20;
System.out.println(“姓名:”+zhangsan.name);
System.out.println(“姓名:”+zhangsan.sex);
System.out.println(“姓名:”+zhangsan.age);
people lisi=new people();
System.out.println(“请输入第二个人的信息”);
lisi.getInfo(“李四”,”女”,23);
lisi.showInfo();
System.out.println(“请输入第三个人的信息”);
lisi.getInfo(“王二”,”女”,22);
lisi.showInfo();
}
}