code implemented
This commit is contained in:
@ -2,5 +2,12 @@
|
||||
* Created by Alexis on 28-Apr-17.
|
||||
*/
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
Guard guard = new Guard();
|
||||
|
||||
if (guard instanceof Permission) {
|
||||
guard.enter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
10
marker/src/main/java/Guard.java
Normal file
10
marker/src/main/java/Guard.java
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Created by Alexis on 29-Apr-17.
|
||||
*/
|
||||
public class Guard implements Permission {
|
||||
|
||||
protected static void enter() {
|
||||
System.out.println("You can enter");
|
||||
}
|
||||
|
||||
}
|
7
marker/src/main/java/Permission.java
Normal file
7
marker/src/main/java/Permission.java
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Created by Alexis on 29-Apr-17.
|
||||
* Interface without any methods
|
||||
* Marker interface is based on that assumption
|
||||
*/
|
||||
public interface Permission {
|
||||
}
|
Reference in New Issue
Block a user