Question: In the following code, where do you find overloading and where do you find overriding? Why? public class HumanBeing { private String name; public HumanBeing(String
In the following code, where do you find overloading and where do you find overriding? Why? public class HumanBeing { private String name; public HumanBeing(String myName) { name = myName; } public String getInfo)( { return "I am a human being " ; }} public class Student extends HumanBeing { private int id; private static int nextId = 0; public Student(String theName) { super(theName); id = nextId; nextId;++ } public int getId() {return id;} public void setId (int theId) { this.id = theId;} public void getInfo(){ System.out.println( "I am a student " ); } public String getInfo(){ return "I am a student " ; } public String getInfo(int num){ String s = "I am a student nr: " +num; return s;}}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
