Skip to content

Commit

Permalink
Updates Launch Multi-File Source-Code Programs example
Browse files Browse the repository at this point in the history
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
  • Loading branch information
manoelcampos committed Apr 6, 2024
1 parent 5402520 commit 1d020c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
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);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* A class that is used by {@link Jdk22Class2} in order to show
* A class that is used by {@link Jdk22SubClass} in order to show
* the Launch Multi-File Source-Code Programs feature.
* @author Manoel Campos
* @see Jdk22Class2
* @see Jdk22SubClass
*/
public class Jdk22Class1
public class Jdk22SuperClass
{
private final String name;

public Jdk22Class1(String name) {
public Jdk22SuperClass(String name) {
this.name = name;
}

Expand Down

0 comments on commit 1d020c3

Please sign in to comment.