-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
50 lines (39 loc) · 746 Bytes
/
Copy pathTest.java
File metadata and controls
50 lines (39 loc) · 746 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
/**
* @author viktorvoltz
*/
enum Real{
dotnet,
java
}
abstract class TimeView{
abstract void mean();
public TimeView timeView(Real real){
switch(real){
case dotnet: return new Dotnet();
case java: return new Java();
default: return null;
}
}
}
class Dotnet extends TimeView{
@Override
void mean() {
System.out.println("dotnet()");
}
}
class Java extends TimeView{
Java(){
mean();
}
@Override
void mean() {
System.out.println("java()");
}
}
public class Test{
public static void main(String[] args){
TimeView d = new Dotnet();
d.timeView(Real.java);
//d.mean();
}
}