Question: Consider the following Java program. Explain the purpose and the output of the program. class First { void check() { System.out.println(This is the class First);

Consider the following Java program. Explain the purpose and the output of the program. class First { void check() { System.out.println("This is the class First"); } } // First ends j'first class Second extends First { void check(String name) { System.out.println("This is the class } } //Second ends 11 + name); class Main { public static void main(String[] args) { Second obj = new Second(); obj.check("Second"); First obj1 = new First(); obji.check(); First obj2 = new Second(); obj2.check(); } } //Main ends
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
