class Animal {
String name;
int age;
Animal(){
name="Dog";
age=3;
}
Animal(String name,int age){
this.name=name;
this.age=age;
}
}
public class AnimalDemo{
public static void main(String args[]){
Animal a=new Animal();
Animal b=new Animal("cat",5);
System.out.println(a.name+" is "+a.age+" years old");
System.out.println(b.name+" is "+b.age+" years old");
}
}