class Person
{
  private int age;
  private String name;
  void shout()
  {
   //int age = 60;
   System.out.println(name + "'s age is " + age);
  }
  public Person()
  {
   //age = 10;
   System.out.println("The condtructor1 is calling!");
  }
 
  public Person(String x)
  {
   name = x;
  }
  public Person(String x,int y)
  {
   name = x;
   age = y;
  }
  public void setAge(int x)
  {
   if (age < 0)
    return;
   age = x;
  }
  public int getAge()
  {
   return age;
  }
  public  void getSomeOne(Person p)
  {
  p.shout();
  }
  public void fun1()
  {
   System.out.println(name);
  }
  public void fun2()
  {
   Person a2 = new Person("a2");
   a2.fun1();
  }
   public static void main (String [] agrs)
  {
   Person a1 = new Person("a1");
   /*Person p1 = new Person();
   Person p2 = new Person("zhangsan",25);
   Person p3 = new Person("wangwu");
   p1.age = -30;
   p1.shout();
    p2.shout();
    p3.shout();*/
   
    //p1.getSomeOne(p2);
    new Person().shout();  //不指定对象名,但也是一个对象,故可以调用方法
    //匿名调用,如果只调用对象一次,可以使用这种方法
   
    /*String str1 = new String("abc");
    String str2 = new String("abc");
    String str3 = str1;
    if (str1.equals(str2))
     System.out.println("true");
    else
     System.out.println("false");*/
     
     //getSomeOne(new Person());
  }
 
}
class TestPerson
{
 public static void main (String [] agrs)
  {
   Person p1 = new Person();
   Person p2 = new Person();
   //p1.age = -30;
   p1.shout();
    p2.shout();
    new Person().shout();  //不指定对象名,但也是一个对象,故可以调用方法
    //匿名调用,如果只调用对象一次,可以使用这种方法
   
    /*String str1 = new String("abc");
    String str2 = new String("abc");
    String str3 = str1;
    if (str1.equals(str2))
     System.out.println("true");
    else
     System.out.println("false");*/
     
     getSomeOne(new Person());
  }
  public static void getSomeOne(Person p)
  {
   p.shout();
  }
}