0

What are Threads?

Why and where should I use threads in Java? I couldn't understand well from the tutorial.

21st Mar 2018, 4:48 PM
NavMen
2 Respuestas
+ 9
A thread, in the context of Java, is the path followed when executing a program. All Java programs have at least one thread, known as the main thread, which is created by the Java Virtual Machine (JVM) at the program's start, when the main() method is invoked with the main thread.
21st Mar 2018, 5:30 PM
Baraa AB
Baraa AB - avatar
+ 2
Be careful with threads. They’re really hard to use and have caused me so many headaches. But basically, I often use threads when I need a a block of code to run for some time (like the duration of my program) and be called every frame. Here are some more resources: http://www.wideskills.com/java-tutorial/java-threads-tutorial https://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html https://www.tutorialspoint.com/java/java_multithreading.htm
21st Mar 2018, 5:00 PM
Ariela
Ariela - avatar