a3 move to Question1
This commit is contained in:
36
assignment3/Question1/Human.java
Normal file
36
assignment3/Question1/Human.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
|
||||
* Date: 2022-04-11
|
||||
* Description: Human class
|
||||
*/
|
||||
|
||||
public class Human extends Mammal {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* The Constructor take no argument. All human are named "Alice"
|
||||
*/
|
||||
public Human() {
|
||||
super("Alice");
|
||||
}
|
||||
|
||||
/**
|
||||
* Human cannot be cooked.
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
@Override
|
||||
public boolean isCookable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
*/
|
||||
public static void testHuman() {
|
||||
Human human = new Human();
|
||||
System.out.println(human.getName() == "Alice");
|
||||
System.out.println(human.isCookable() == false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user