What is the output of the below program? package com.aricent.interview; class C { static int a=3; void m1() {} void m2() {} void m3() {} static void m4() {System.out.println("--Parent class--static--method---");} } class B extends C { void m1() {} void m2() {} void m3() {} static void m4() {System.out.println("---Child class ---static method---");} void m5() {} } public class A { public static void main(String[] args) { C c=new B(); c.m1(); c.m2(); c.m3(); c.m4(); c=null; c.a=8; System.out.println(c.a); c.m5(); } }
Sigiloso
Output: 1) The method m5() is undefined for the type C 2) If c.m5() is commented then : --Parent class--static--method--- 8