first commit
This commit is contained in:
25
CS1322/t3/Cat.java
Normal file
25
CS1322/t3/Cat.java
Normal file
@@ -0,0 +1,25 @@
|
||||
//test
|
||||
public class Cat extends Animal{
|
||||
public Cat(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public Cat(){
|
||||
}
|
||||
public void speak(){
|
||||
|
||||
System.out.println("Meow. My name is " + this.name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void nap(){
|
||||
|
||||
System.out.println("Taking a nap. Zzzzzz");
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
|
||||
return "I am an cat named " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user