Java examples for Object Oriented Design:Constructor
Calls the Constructor of the base Class Explicitly
class Employee {// w ww .j a va2 s.c o m private String name = "Unknown"; public Employee(String name) { this.name = name; } public void setName(String name) { this.name = name; } public String getName() { return name; } } class Manager extends Employee { public Manager(String name) { super(name); } } public class Main { public static void main(String[] args) { Manager mgr = new Manager("Edith"); String name = mgr.getName(); System.out.println("Manager name: " + name); } }