What is thread?

Answer Posted / javamasque

Threads are lightweight process which lives inside process. These are independently running programs which have concurrent path of execution. Each thread has its own 1. Java stack 2. Program counter and 3. Native stack but have common heap space. Multiple threads with in same process share same variables and objects. They allocates objects from same heap and even they can share same instructions (execution code) at particular time. As a result above common access they can easily share information to each other.

Every program has at least one thread i.e. main thread. JVM creates main thread which calls main method to execute whole program. The main thread is non-daemon thread. Any thread created by main method is non-daemon thread by default.

JVM has daemon threads for garbage collection, object finalization and other housekeeping jobs.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between method and means?

572


What is boolean flag in java?

573


Explain static nested classes ?

589


What differences exist between iterator and listiterator?

567


What is unicode full form?

548






Why is java so popular?

631


Why is string buffer better than string ?

594


What is difference between ++ I and I ++ in java?

524


How can you add and remove nodes in jtree?

610


Is .net better than java?

552


What is the difference between a scrollbar and a scrollpane?

556


What is the multi-catch block in java?

528


Explain the difference between static and dynamic binding in java?

539


What data type is a string?

511


Tell us something about an iterator.

544