lab5
This commit is contained in:
38
lab/lab5/Question7/LivingThing.java
Normal file
38
lab/lab5/Question7/LivingThing.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* AutoRobot: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
|
||||
* Date: 2022-03-19
|
||||
* Description: This is the class of LivingThing.
|
||||
*/
|
||||
|
||||
public class LivingThing {
|
||||
/**
|
||||
* Name of the LivingThing.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Constructor of LivingThing.
|
||||
*
|
||||
* @param name Name of the LivingThing.
|
||||
*/
|
||||
public LivingThing(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the LivingThing.
|
||||
*
|
||||
* @return The name of the LivingThing.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
*/
|
||||
public static void testLiving() {
|
||||
LivingThing living = new LivingThing("LivingThing");
|
||||
System.out.println(living.getName() == "LivingThing");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user