В Java существует два способа создания thread: public class MyThread extends Thread {
public void run() {
System.out.println("Hello from a thread!");
}
public static void main(String[] args) {
MyThread thread = new MyThread();
thread.start();
}
} public class MyRunnable implements Runnable {
public void run() {
System.out.println("Hello from a thread!");
}
public static void main(String[] args) {
Thread thread = new Thread(new MyRunnable());
thread.start();
}
} 1606 вопрос-ответ по Java: https://github.com/DEBAGanov/interview_questions Tелеграмм канал: https://t.me/DEBAGanov Мое резюме: https://github.com/DEBAGanov