BAEL-6971 Unnamed Classes and Instance Main Methods in Java 21 (#14841)

* BAEL-6727 Streams vs. Loops in Java

* BAEL-6971 - Unnamed Classes and Instance Main Methods in Java 21

* BAEL-6971 - decomment code

* BAEL-6971 - add child class

* BAEL-6971 - add unnamed class with method
This commit is contained in:
Alexandru Borza 2023-10-02 16:09:22 +03:00 committed by GitHub
parent 2ed008decc
commit dc512cc408
4 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,3 @@
void main() {
System.out.println("Hello, World!");
}

View File

@ -0,0 +1,7 @@
package com.baeldung.unnamedclasses;
public class HelloWorldChild extends HelloWorldSuper {
void main() {
System.out.println("Hello, World!");
}
}

View File

@ -0,0 +1,7 @@
package com.baeldung.unnamedclasses;
public class HelloWorldSuper {
public static void main(String[] args) {
System.out.println("Hello from the superclass");
}
}

View File

@ -0,0 +1,6 @@
private String getMessage() {
return "Hello, World!";
}
void main() {
System.out.println(getMessage());
}