-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (31 loc) · 956 Bytes
/
Main.java
File metadata and controls
38 lines (31 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public class Main {
public static void main(String[] args) {
Child Jim = new Child("Jim", "Smithson", "blue");
Jim.getLastName();
Jim.parentEyeColor();
}
}
// class Parent {
// String last_name;
// String eye_color;
// Parent(String last_name, String eyeColor) {
// this.last_name = last_name;
// this.eye_color = eyeColor;
// }
// void getLastName() {
// System.out.println("This person's last name is " + this.last_name);
// }
// }
class Child extends Parent {
String first_name;
Child(String first_name, String lastName, String eyeColor) {
super(lastName, eyeColor);
this.first_name = first_name;
}
void getFullName() {
System.out.println("This is" + first_name + " his last name is " + last_name + ".");
}
void parentEyeColor() {
System.out.println("The parent has " + super.eye_color + " eyes.");
}
}