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 jdk, jre, and jvm?

576


What is the difference between method and means?

574


How can we create a thread in java?

589


What are the difference between string, string builder, and string buffer in java?

557


Can we convert stringbuilder to string in java?

562






What are 3 data types?

549


Why bytecode is called bytecode?

594


What do you mean by collectors in java 8?

544


Can this keyword be used to refer static members?

551


What is final access modifier in java?

596


What is Hierarchy of exception?

652


Can It is possible to synchronize the constructor of a Java Class?

599


What is the symbol for average?

522


What is a line break example?

580


What is linked hashmap and its features?

548