What is the output of the following code?   class Parent {vo…

Written by Anonymous on May 7, 2026 in Uncategorized with no comments.

Questions

Whаt is the оutput оf the fоllowing code?   clаss Pаrent {void print() {System.out.println("Parent"); }}class Child extends Parent { @Overridevoid print() {System.out.println("Child"); }}public class Main {public static void main(String[] args) {Parent p = new Child();p.print(); }}

Comments are closed.