Skip to content

Commit 2b8a255

Browse files
committed
JEP 458: Launch Multi-File Source-Code Programs
1 parent b407412 commit 2b8a255

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This repository contains Java examples that are designed to track and document t
88
## Specifications & Practices
99

1010
* [Java 22](java-22) (March, 2024)
11+
* [JEP 458](java-22/src/main/java/com/ibrahimatay/JEP458LaunchMultiFileSourceCode.java): Launch Multi-File Source-Code Programs]
1112

1213
* [Java 21](java-21) (September, 2023)
1314
* [JEP 430](java-21/src/main/java/com/ibrahimatay/JEP430StringTemplates.java): String Templates
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.ibrahimatay;
2+
3+
// JEP 458: Launch Multi-File Source-Code Programs
4+
// https://openjdk.org/jeps/458
5+
6+
// JEP draft: Launch Multi-File Source-Code Programs
7+
// https://www.reddit.com/r/java/comments/11u1w17/jep_draft_launch_multifile_sourcecode_programs/
8+
9+
// java --enable-preview --source 22 JEP458LaunchMultiFileSourceCode.java
10+
11+
public class JEP458LaunchMultiFileSourceCode {
12+
static {
13+
System.out.println("LaunchMultiFileSourceCodeProgramMain static initializer");
14+
}
15+
16+
void main() {
17+
System.out.println("Here the launcher will compile and load the other Java file");
18+
var value = LaunchMultiFileSourceCodeHelper.generateValue();
19+
System.out.println("Value: " + value);
20+
}
21+
}
22+
23+
class LaunchMultiFileSourceCodeHelper {
24+
static {
25+
System.out.println("LaunchMultiFileHelper static initializer");
26+
}
27+
28+
public static int generateValue() {
29+
return 42;
30+
}
31+
}

0 commit comments

Comments
 (0)