1class Demo{
2 public static void demoMethod() {
3 System.out.println("method of super class");
4 }
5}
6public class Sample extends Demo {
7 public static void demoMethod() {
8 System.out.println("method of sub class");
9 }
10 public static void main(String args[] ) {
11 Sample.demoMethod();
12 Demo sm= new Sample();
13 sm.demoMethod();
14 }
15}