Answers for "method hiding in java"

0

method hiding in java

class Demo{
   public static void demoMethod() {
      System.out.println("method of super class");
   }
}
public class Sample extends Demo {
   public static void demoMethod() {
      System.out.println("method of sub class");
   }
   public static void main(String args[] ) {
      Sample.demoMethod();
     Demo sm= new Sample();
     sm.demoMethod();
   }
}
Posted by: Guest on May-20-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language