-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16cada5
commit 67a1965
Showing
8 changed files
with
337 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,66 @@ | ||
package oops.sub;public class Human { | ||
package oops.sub; | ||
|
||
public class Human { | ||
|
||
int age; | ||
String name; | ||
double salary; | ||
boolean isMarried; | ||
static int POPULATION = 0; | ||
|
||
public Human() { | ||
} | ||
|
||
public Human(String name, int age, double salary, boolean isMarried) { | ||
this.name = name; | ||
this.age = age; | ||
this.salary = salary; | ||
this.isMarried = isMarried; | ||
POPULATION += 1; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Human{" + | ||
"age=" + age + | ||
", name='" + name + '\'' + | ||
", salary=" + salary + | ||
", isMarried=" + isMarried + | ||
'}'; | ||
} | ||
|
||
static class Test { | ||
String test = "Testing"; | ||
|
||
public String test(String name) { | ||
return name + " is " + this.test; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
Singleton singleton = Singleton.getInstance(); | ||
System.out.println(singleton.name()); | ||
|
||
} | ||
} | ||
|
||
class Chinese extends Human { | ||
|
||
String language; | ||
|
||
public Chinese() { | ||
super("Chinese", 73, 40000, true); | ||
} | ||
|
||
public Chinese(String language) { | ||
this.language = language; | ||
} | ||
} | ||
|
||
class Cantonese extends Human { | ||
|
||
|
||
public Cantonese(String name, int age, double salary, boolean married) { | ||
super(name, age, salary, married); | ||
} | ||
} |
Oops, something went wrong.