-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinterfaces.html
More file actions
64 lines (50 loc) · 1.28 KB
/
interfaces.html
File metadata and controls
64 lines (50 loc) · 1.28 KB
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
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://javaalmanac.io/almanac.min.css">
</head>
<body>
<div class="content" id="content">
<sandbox version="java17" mainclass="Main" preview="true" v-cloak>
<sandbox-source name="Main.java">
interface AInterface {
default String message() {
return "Hallo A";
}
}
class A implements AInterface {
}
interface BInterface extends AInterface {
default String message() {
return "Hallo B";
}
}
class B implements BInterface {
}
class C extends B {
public String message() {
return "Hallo C";
}
}
class D extends C implements AInterface { }
interface Z { static void print() { System.out.println("Hello Z"); }}
class ZZ implements Z {}
public class Main {
public static void main(String[] args) {
AInterface a = new A();
System.out.println(a.message());
AInterface b = new B();
System.out.println(b.message());
AInterface c = new C();
System.out.println(c.message());
AInterface d = new D();
System.out.println(d.message());
Z.print();
}
}</sandbox-source>
</sandbox>
</div>
<script src="https://javaalmanac.io/app/sandbox-bundle.js"></script>
<script>new Vue({ el: '#content' })</script>
</body>
</html>