Skip to content

Instantly share code, notes, and snippets.

@maxandersen
Forked from franz1981/Main.java
Last active November 6, 2023 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxandersen/ce014e0e9497d4848c4ab1c503b22850 to your computer and use it in GitHub Desktop.
Save maxandersen/ce014e0e9497d4848c4ab1c503b22850 to your computer and use it in GitHub Desktop.
//JAVA 21+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main {
static {
System.out.print("Hello,");
try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) {
executor.submit(() -> {}).get();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("it's me");
}
public static void main(String[] args) {
System.out.println("Hello, can you hear me?");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment