You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importmodulejava.base; // JEP 511, final in Java 25publicclassMain {
publicstaticvoidmain(String[] args) {
List<String> messages = List.of("Hello", "World");
System.out.println(messages);
}
}
Output:
importjava.base; // JEP 511, final in Java 25publicclassMain {
publicstaticvoidmain(String[] args) {
List<String> messages = List.of("Hello", "World");
System.out.println(messages);
}
}
Expected behavior:
Output should be the same as Input.
Java code in Input runs successfully when using JDK 25 and prints to console:
[Hello, World]
Java code in Output doesn't run when using JDK 25, because module keyword was removed, exception is:
Main.java:1: error: cannot find symbol
import java.base; // JEP 511, final in Java 25
^
symbol: class base
location: package java
Main.java:6: error: cannot find symbol
List<String> messages = List.of("Hello", "World");
^
symbol: class List
location: class Main
Main.java:6: error: cannot find symbol
List<String> messages = List.of("Hello", "World");
^
symbol: variable List
location: class Main
3 errors
error: compilation failed
Activity