1package test.main;
2
3public class TestOverload {
4
5 public static void main(String args[]) {
6
7 Base obj = new Derived();
8
9 obj.display();
10 obj.print();
11 }
12
13}
14
15class Base {
16
17 public static void display() {
18 System.out.println("Base Class Display Called");
19 }
20
21 public void print() {
22 System.out.println("Base Class Print Called");
23 }
24}
25
26class Derived extends Base {
27
28 public static void display() {
29 System.out.println("Derived Class Display Called");
30 }
31
32 public void print() {
33 System.out.println("Derived Class Print Called");
34 }
35}
36
1package test.main;
2
3public class TestOverload {
4
5 public static void main(String args[]) {
6
7 TestOverload.show();
8 TestOverload.show("FrugalisMinds");
9 }
10
11 public static void show() {
12 System.out.println("Show Called ");
13 }
14
15 public static void show(String name) {
16 System.out.println("Overloaded Show Called" + name);
17 }
18}
19
1package test.main;
2
3public class TestOverload {
4
5 public static void main(String args[]) {
6
7 TestOverload.show();
8 TestOverload.show("FrugalisMinds");
9 }
10
11 public static void show() {
12 System.out.println("Show Called ");
13 }
14
15 public void show(String name) {
16 System.out.println("Overloaded Show Called" + name);
17 }
18}
19