package com.ctgu.java;
//import javax.sound.midi.MidiDevice.Info;
public class TestPerson {
public static void main(String[] args) {
Person p =new Person();
p.setAge(10);
p.info();
p.setName(" ");
p.info();
System.out.println();
Person p1 = new Person(" ",23);
p1.info();
Person p2 = new Person(23);
p2.info();
}
}
class Person{
private String name;
private int age ;
public Person(){
name = "Lucy";
age = 1;
}
public Person(String name){
System.out.println(" Person name ");
this.name = name;
}
public Person(int age){
this();
this.age = age ;
}
public Person(String name , int age){
//this.name = name;
this(name);
System.out.println(" Person name age ");
this.age = age;
}
public void setName(String n){
name = n;
}
public String getName(){
return name;
}
public void setAge(int age){
this.age = age;
}
public int getAge(){
return age;
}
public void eat(){
System.out.println(" ");
}
public void sleep(){
System.out.println(" ");
}
public void info(){
System.out.println("name:"+ this.name +" age:"+this.age);
this.show();
}
public void show(){
System.out.println(" :"+this.name);
}
}