Core Java Tutorials

Home Index About

Program 12:

  • Write a Java program to create a class known as Person with methods called getFirstName() and getLastName(). Create a subclass called Employee that adds a new method named getEmployeeId() and overrides the getLastName() method to include the employee's job title.
  • Input:

    Output: