-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates Launch Multi-File Source-Code Programs example
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
- Loading branch information
1 parent
5402520
commit 1d020c3
Showing
2 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
13 changes: 6 additions & 7 deletions
13
src/main/java/Jdk22Class2.java → src/main/java/Jdk22SubClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
/** | ||
* A sample class that doesn't belong to any package, | ||
* that uses {@link Jdk22Class1}, and enables you to compile | ||
* that uses {@link Jdk22SuperClass}, and enables you to compile | ||
* all required classes and run this {@link #main(String[])} method | ||
* just typing at the terminal: {@snippet lang=bash : java Jdk22Class2.java} | ||
* | ||
* @author Manoel Campos | ||
* @see <a href="https://openjdk.org/jeps/458">https://openjdk.org/jeps/458</a> | ||
*/ | ||
public class Jdk22Class2 { | ||
private final Jdk22Class1 class1 = new Jdk22Class1("class1"); | ||
|
||
public class Jdk22SubClass extends Jdk22SuperClass{ | ||
public static void main(String[] args) { | ||
new Jdk22Class2(); | ||
var obj = new Jdk22SubClass("Manoel"); | ||
System.out.println("Name: " + obj.getName()); | ||
} | ||
|
||
public Jdk22Class2() { | ||
System.out.println("Name: " + class1.getName()); | ||
public Jdk22SubClass(String name) { | ||
super(name); | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
src/main/java/Jdk22Class1.java → src/main/java/Jdk22SuperClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters