Gitlab@Informatics

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

add class Pet and test class

parent 85208dd6
Branches main
No related tags found
No related merge requests found
......@@ -2,8 +2,9 @@
public class Main {
public static void main(String[] args) {
System.out.print("hi");
Pet p = new Pet("jeemz","white");
System.out.print("Pet name is " + p.getName() + " color is " + p.getColor() +" sound is " + p.voice());
}
......
public class Pet {
private String name;
private String color;
public Pet() {}
public Pet(String name, String color) {
super();
this.name = name;
this.color = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String voice() {
return "none";
}
}
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