Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HelloThread extends Thread {
- @Override
- public void run() {
- System.out.println("Hello from a thread1!");
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- System.out.println("Hello from a thread2!");
- }
- }
- public class Main {
- public static void main(String[] args) {
- System.out.println("Hello world!");
- var helloThread = new HelloThread();
- helloThread.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement