File tree 3 files changed +20
-3
lines changed
3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ To run each example use: `java --enable-preview --source 22 <FileName.java>`
246
246
* re-preview for additional feedback
247
247
* **Implicity Declared Classes and Instance Main Methods**
248
248
* 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
250
250
* "source file without an enclosing class declaration is said to implicitly declare a class with a name chosen by the host system"
251
251
* changed the procedure for selecting a main method to invoke
252
252
* first it looks for a method `main(String[])`, if not found then it looks for a method `main()`
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ To run each example use: `java --enable-preview --source 23 <FileName.java>`
11
11
* [ 473] ( https://openjdk.org/jeps/473 ) - Stream Gatherers (Second Preview)
12
12
* [ 474] ( https://openjdk.org/jeps/474 ) - ZGC: Generational Mode by Default
13
13
* [ 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)
14
15
15
16
## Features
16
17
@@ -52,12 +53,20 @@ To run each example use: `java --enable-preview --source 23 <FileName.java>`
52
53
* ambiguous import:
53
54
* in case of two module exporting the same class name, we will have to import the class directly
54
55
* ``` 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
57
58
import java.sql.Date ;
58
59
```
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`
59
67
60
68
## Links
61
69
62
70
* [JDK 23 - JEP Dashboard](https:// bugs.openjdk.org/secure/Dashboard.jspa?selectPageId=22205)
71
+ * [JDK 32 JEPs](https:// openjdk.org/projects/jdk/23/)
63
72
You can’t perform that action at this time.
0 commit comments