Computer Science › Class Relationships
CONSIDER THE FOLLOWING JAVA CODE:
**public class Employee**
**{**
static int nextID = 1;
String name;
int employeeID;
``
Employee(String n){
name = n;
employeeID = nextID;
nextID++;
}
public String getName(){
return name;
}
public int getID(){
return employeeID;
}
public static void main(String[] args)
{
Employee emp3 = new Employee("Kate");
Employee emp1 = new Employee("John");
Employee emp2 = new Employee("Sandy");
System.out.println(emp1.getName() + " ID: " + emp1.getID());
System.out.println(emp3.getName() + " ID: " + emp3.getID());
}
**}**
WHAT WOULD BE THE CONSOLE OUTPUT?
What is the difference between extending and implementing?
Describe the difference between overloading a method and overriding a method.
What is the relationship between the class Car and the class TwoDoor in the code snippet below?
class TwoDoor extends Car {
}