-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParent.java
More file actions
44 lines (33 loc) · 900 Bytes
/
Parent.java
File metadata and controls
44 lines (33 loc) · 900 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
39
40
41
42
43
44
package com.dj;
public class Parent {
static {
System.out.println("Parent static initializer: class being constructed");
}
private final String name;
private final String dob;
protected final int siblings;
{
// name = "John Doe";
// dob = "01/01/1900";
System.out.println("In Parent Initializer");
}
// public Parent() {
// System.out.println("In Parent's No Args Constructors");
// }
public Parent(String name, String dob, int siblings) {
this.name = name;
this.dob = dob;
this.siblings = siblings;
System.out.println("In Parent Constructor");
}
public String getName() {
return name;
}
public String getDob() {
return dob;
}
@Override
public String toString() {
return "name= '" + name + '\'' + ", dob ='" + dob + '\'';
}
}