Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

CORE API / CATATAN</>
Core API07 Nov 2010

How do I get the currently executing thread?

To get the currently executing thread, use the static currentThread() method of the Thread class. This method returns a reference of the currently executing thread object. package org.kodejava.lang; public class GetCurrentThreadDemo { public static void main(String[] args) { // Get the currently executing thread object Thread thread = Thread.currentThread(); System.out.println("Id : " + thread.getId()); System.out.println("Name […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API07 Nov 2010

How do I set and get the name of a thread?

You can assign a name to thread instance by using the setName() method and get the name of the thread using the getName() method. The naming support is also available as a constructor of the Thread class such as Thread(String name) and Thread(Runnable target, String name). package org.kodejava.lang; public class ThreadNameDemo extends Thread { public […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API07 Nov 2010

How do I check if a thread is alive?

A thread is alive or running if it has been started and has not yet died. To check whether a thread is alive use the isAlive() method of Thread class. It will return true if this thread is alive, otherwise return false. package org.kodejava.lang; public class ThreadAliveDemo implements Runnable { public static void main(String[] args) […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API06 Nov 2010

How do I check if a thread is a daemon thread?

You can test if a thread is a daemon thread or a user thread by calling the isDaemon() method of the Thread class. If it returns true then the thread is a daemon thread, otherwise it is a user thread. package org.kodejava.lang; public class ThreadCheckDaemon implements Runnable { public static void main(String[] args) { Thread […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API06 Nov 2010

How do I create a daemon thread?

A daemon thread is simply a background thread that is subordinate to the thread that creates it, so when the thread that created the daemon thread ends, the daemon thread dies with it. A thread that is not a daemon thread is called a user thread. To create a daemon thread, call setDaemon() method with […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API05 Nov 2010

How do I use the sleep method of the Thread class?

Here is another example that use the Thread.sleep() method. In the example we create two instances of the ThreadSleepAnotherDemo, we give each thread a name and the sleep interval so that we can see how to thread execution. package org.kodejava.lang; import java.util.Calendar; public class ThreadSleep implements Runnable { private final String threadName; private final long […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.