-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Java15Features.java
30 lines (30 loc) · 964 Bytes
/
Java15Features.java
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
//package java15;
//
//import org.junit.Test;
//
//public class Java15Features {
//
// /**
// * Java 15 introduce [sealed] class just like Scala had, to create super classes that must be extended
// * by subclass. It also contains a cool feature which is [permits] where as a sealed class, only allow to be
// * extended by some specific classes.
// * <p>
// * Here in order to make this whole bound perfect, Javas introduce [non-sealed], which means
// * The subclass must extend a [sealed] class
// */
// public sealed class MySealedClass permits SealedClassExtension {
// public String helloSealedWorld = "hello world";
// }
//
// public non-sealed class SealedClassExtension extends MySealedClass {
// public void init() {
// System.out.println(helloSealedWorld);
// }
// }
//
// @Test
// public void sealedFeature() {
// new SealedClassExtension().init();
// }
//
//}