Skip to content

Commit 8530d01

Browse files
committed
code implemented
1 parent a34e7be commit 8530d01

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

marker/src/main/java/App.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
* Created by Alexis on 28-Apr-17.
33
*/
44
public class App {
5+
public static void main(String[] args) {
6+
Guard guard = new Guard();
57

8+
if (guard instanceof Permission) {
9+
guard.enter();
10+
}
11+
}
612
}
13+

marker/src/main/java/Guard.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Created by Alexis on 29-Apr-17.
3+
*/
4+
public class Guard implements Permission {
5+
6+
protected static void enter() {
7+
System.out.println("You can enter");
8+
}
9+
10+
}

marker/src/main/java/Permission.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Created by Alexis on 29-Apr-17.
3+
* Interface without any methods
4+
* Marker interface is based on that assumption
5+
*/
6+
public interface Permission {
7+
}

0 commit comments

Comments
 (0)