Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 16502614 authored by 65160269's avatar 65160269
Browse files

add class Cat and test class

parent 9ff7ce8b
No related branches found
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,7 +2,7 @@
public class Main {
public static void main(String[] args) {
Pet p = new Dog("Bew","Red");
Pet p = new Cat("Bew","Red");
System.out.print("Pet 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.
Please register or to comment