source file name: OverrideSuperDemo.java class Human{ //Overridden method public void eat() { System.out.println("Human is eating anyhings"); } } class Person extends Human{ //Overriding method public void eat() { super.eat(); System.out.println("Person is eating veg or …
Read more
Showing posts from July, 2021Show all
5) Write a Java program to demonstrate Overriding methods and Access-Modifiers concepts.
BySJN Programming
-
// A Simple Java program to demonstrate // Overriding and Access-Modifiers source file name: OverrideDemo.java class Parent { // private methods are not overridden void m1() { System.out.println("From parent m1()"); } protected void m2() { System.out.println("From parent m2()"…
Read more