-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGamingDemo.java
More file actions
61 lines (42 loc) · 874 Bytes
/
GamingDemo.java
File metadata and controls
61 lines (42 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package Interfaces;
// 100% Abstract (Java7)
interface SuperPower {
void power();
}
abstract interface IPlayer {
public static final int MAX_JUMP = 100;
void jump(); // Player can Jump
void attack(); // public abstract void attack();
}
class BlackPlayer implements IPlayer {
int jumpValue = 10;
@Override
public void jump() {
if (jumpValue < MAX_JUMP) {
jumpValue++;
}
System.out.println("Jump Low " + jumpValue);
}
@Override
public void attack() {
// TODO Auto-generated method stub
}
}
class RedPlayer implements IPlayer, SuperPower {
@Override
public void jump() {
System.out.println("Jump High");
}
@Override
public void attack() {
}
@Override
public void power() {
// TODO Auto-generated method stub
}
}
public class GamingDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}