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 = 30 ;
p1.address="重庆";
p1.sex='m';
p1.weight=90;
// 给p2的属性赋值
p2.name = "李四" ;
p2.age = 30 ;
p2.address="海南";
p2.sex='w';
p2.weight=75;
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);
}
}