Skip to content

Commit 0833ba5

Browse files
committed
JDK 23: update JEPs
1 parent cf3e1c8 commit 0833ba5

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

java-22/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ To run each example use: `java --enable-preview --source 22 <FileName.java>`
246246
* re-preview for additional feedback
247247
* **Implicity Declared Classes and Instance Main Methods**
248248
* minor change from JDK 21
249-
* changed the concept name from unnamed class to implicity declared class
249+
* changed the concept name from unnamed class to implicitly declared class
250250
* "source file without an enclosing class declaration is said to implicitly declare a class with a name chosen by the host system"
251251
* changed the procedure for selecting a main method to invoke
252252
* first it looks for a method `main(String[])`, if not found then it looks for a method `main()`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
void main() {
3+
// java.io.IO.readln
4+
String name = readln("Enter your name:");
5+
6+
// java.io.IO.println
7+
println("Hello " + name + "!");
8+
}

java-23/README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To run each example use: `java --enable-preview --source 23 <FileName.java>`
1111
* [473](https://openjdk.org/jeps/473) - Stream Gatherers (Second Preview)
1212
* [474](https://openjdk.org/jeps/474) - ZGC: Generational Mode by Default
1313
* [476](https://openjdk.org/jeps/476) - Module Import Declarations (Preview)
14+
* [477](https://openjdk.org/jeps/477) - Implicitly Declared Classes and Instance Main Methods (Third Preview)
1415

1516
## Features
1617

@@ -52,12 +53,20 @@ To run each example use: `java --enable-preview --source 23 <FileName.java>`
5253
* ambiguous import:
5354
* in case of two module exporting the same class name, we will have to import the class directly
5455
* ```java
55-
import module java.base;
56-
import module java.sql;
56+
import module java.base; // java.util.Date
57+
import module java.sql; // java.sql.Date
5758
import java.sql.Date;
5859
```
60+
* **Implicitly Declared Classes and Instance Main Methods**
61+
* major change from JDK 21 and 22
62+
* implicitly import methods from a new class `java.io.IO`
63+
* new class created for convenience IO
64+
* provides methods: `print(Object)`, `println(Object)` and `readln(String)`
65+
* this class uses return from `System.console()` to print and read from the default input and output streams
66+
* implicitly class will automatically import all of the public top-level classes and interfaces from module `java.base`
5967

6068
## Links
6169

6270
* [JDK 23 - JEP Dashboard](https://bugs.openjdk.org/secure/Dashboard.jspa?selectPageId=22205)
71+
* [JDK 32 JEPs](https://openjdk.org/projects/jdk/23/)
6372

0 commit comments

Comments
 (0)