/
n1tron
/
practice07
Обзор
Документация
Войти
/
n1tron
/
practice07
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/main/java/org/example/App.java
29 строк
829 B
RodinRoman
init
23 май 2025, 02:17
23 май 2025, 02:17
4f61476
Код
Авторство
О чём код?
package org.example; public class App { public static void main( String[] args ) throws InterruptedException { long id = Thread.currentThread().getId(); System.out.println("Main thread class id = " + id + " started"); MyThread myThread = new MyThread(); myThread.start(); myThread.join(); //myThread.run(); Runnable task = () -> { long threadId = Thread.currentThread().getId(); System.out.println("Runnable thread class id = " + threadId + " started"); //.... System.out.println("Runnable thread id = " + threadId + " finished"); }; Thread thread = new Thread(task); thread.start(); thread.join(); System.out.println("Main thread class id = " + id + " finished"); } }