Skip to content

Commit 35c5016

Browse files
committed
method hiding
1 parent 0ee2e1a commit 35c5016

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.scope.method;
2+
3+
4+
public class BaseMethodClass {
5+
6+
public static void printMessage() {
7+
System.out.println("base static method");
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.scope.method;
2+
3+
4+
public class ChildMethodClass extends BaseMethodClass {
5+
6+
public static void printMessage() {
7+
System.out.println("child static method");
8+
}
9+
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.baeldung.scope.method;
22

3-
/**
4-
* Created by Gebruiker on 5/6/2018.
5-
*/
63
public class MethodHidingDemo {
7-
public static void main(String[] args) {
84

5+
public static void main(String[] args) {
6+
ChildMethodClass.printMessage();
97
}
108
}

0 commit comments

Comments
 (0)