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:
parent
2ed008decc
commit
dc512cc408
|
@ -0,0 +1,3 @@
|
||||||
|
void main() {
|
||||||
|
System.out.println("Hello, World!");
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.baeldung.unnamedclasses;
|
||||||
|
|
||||||
|
public class HelloWorldChild extends HelloWorldSuper {
|
||||||
|
void main() {
|
||||||
|
System.out.println("Hello, World!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.baeldung.unnamedclasses;
|
||||||
|
|
||||||
|
public class HelloWorldSuper {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello from the superclass");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
private String getMessage() {
|
||||||
|
return "Hello, World!";
|
||||||
|
}
|
||||||
|
void main() {
|
||||||
|
System.out.println(getMessage());
|
||||||
|
}
|
Loading…
Reference in New Issue