Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit d0cc7d9e authored by 65160386's avatar 65160386
Browse files

add class Cat

parent 61cad58e
Branches main
No related tags found
No related merge requests found
public class Cat extends Pet {
public Cat() {
super();
// TODO Auto-generated constructor stub
}
public Cat(String name, String color) {
super(name, color);
// TODO Auto-generated constructor stub
}
@Override
public String voice() {
// TODO Auto-generated method stub
return "Meow Meow";
}
}
......@@ -2,8 +2,8 @@
public class Main {
public static void main(String[] args) {
Pet p = new Dog("jeemz","white");
System.out.print("Dog name is " + p.getName() + " color is " + p.getColor() +" sound is " + p.voice());
Pet p = new Cat("jeemz","white");
System.out.print("Cat name is " + p.getName() + " color is " + p.getColor() +" sound is " + p.voice());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment