Gitlab@Informatics

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

add class Dog and test class

parent 5ed5ea4d
Branches main
No related tags found
No related merge requests found
public class Dog extends Pet {
public Dog() {
super();
// TODO Auto-generated constructor stub
}
public Dog(String name, String color) {
super(name, color);
// TODO Auto-generated constructor stub
}
@Override
public String voice() {
// TODO Auto-generated method stub
return "bruk bruk";
}
}
......@@ -2,8 +2,8 @@
public class Main {
public static void main(String[] args) {
Pet p = new Pet("jeemz","white");
System.out.print("Pet name is " + p.getName() + " color is " + p.getColor() +" sound is " + p.voice());
Pet p = new Dog("jeemz","white");
System.out.print("Dog 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