Lecturer: Djurayev Oybek Nuruddinovich


Download 285.5 Kb.
bet3/4
Sana02.01.2022
Hajmi285.5 Kb.
#194213
1   2   3   4
Bog'liq
Lecture 1 (1)

Threads in OS
  • Life cycle of a Thread (Thread States)
  • Thread class provide constructors and methods to create and perform operations on a thread. Thread class extends Object class and implements Runnable interface.
  • - Thread()
  • - Thread(String name)
  • - Thread(Runnable r)
  • - Thread(Runnable r, String name)
  • Constructors of Thread class
  • Thread firstThread = new Thread();
  • Thread secondThread = new Thread("namedThread");
  • System.out.println(firstThread.getName());
  • System.out.println(secondThread.getName());
  • RESULT:
  • Thread-0
  • namedThread
  • Fragment:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling