Add java11-features module: runnable demos and captured output for the ankurm.com java11-features article

This commit is contained in:
2026-10-20 17:13:58 +00:00
parent 77c782abbf
commit 8b9447a393
19 changed files with 223 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
import javax.xml.bind.JAXBContext;
/** Compiles on 8, fails on 11: JEP 320 removed the Java EE modules (java.xml.bind and friends). */
public class JaxbRemoved {
public static void main(String[] args) throws Exception {
System.out.println(JAXBContext.class.getName());
}
}
@@ -0,0 +1,9 @@
import java.util.function.BiFunction;
/** Fails to compile on purpose: you cannot mix var and explicit types in one lambda's parameters. */
public class VarWithoutLambda {
public static void main(String[] args) {
BiFunction<Integer, Integer, Integer> f = (var a, Integer b) -> a + b;
System.out.println(f.apply(1, 2));
}
}