





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















public class CommonErrors{ public static void display () { System.out.println(“hello world”); }
public static void main (String args[]) { CommonErrors.display(); }
Error: ArrayIndexOutofBoundsException
Error: NullPointerException
Employee. java (super class)
public class Employee{ protected int id; protected String name;
//parameterized constructor public Employee(int id, String name){
this.id = id; this.name = name; }
//default constructor public Employee(){ this (10, “not set”); }
//continue
Employee. java (super class)
public void setId (int id) { this.id = id; }
public int getId () { return id; }
public void setName (String name) { this.name = name; }
public String getName () { return name; }
//continue ….
Teacher. java (sub class)
public class Teacher extends Employee{
private String qual;
//default constructor public Teacher () { //implicit call to superclass default construct qual = ""; }
//parameterized constructor public Teacher(int i, String n, String q){
super(i,n); //call to superclass const must be first line qual = q; } //continue
Teacher. java (sub class)
//accessors for qual
public void setQual (String qual){ this.qual = qual; }
public String getQual(){ return qual; }
//continue