//输入不同对象的姓名、性别、年龄、体重和住址等信息,并输出显示。
package mianxiangduixiangren;
public class Person {
private String name;
private int age;
private String address;
private char sex;
private int weight;
public static void main(String[] args) {Person p1 = new Person( ) ; //声明并实例化一Person对象p1
Person p2 = new Person( ) ; //声明并实例化一Person对象p2
// 给p1的属性赋值
p1.name = "张三" ;
p1.age = 25 ;
p1.address="济南";
p1.sex='m';
p1.weight=100;
// 给p2的属性赋值
p2.name = "李四" ;
p2.age = 30 ;
p2.address="北京";
p2.sex='w';
p2.weight=80;
System.out.println("我是:"+p1.name+",性别:"+p1.sex+",今年:"+p1.age+"岁"+",体重:"+p1.weight+",住址是:"+p1.address);
System.out.println("我是:"+p2.name+",性别:"+p2.sex+",今年:"+p2.age+"岁"+",体重:"+p2.weight+",住址是:"+p2.address);
// TODO 自动生成的方法存根
}