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

Distinguish between a predicate and a function?

569


List out five keywords related to exception handling ?

598


Explain about varargs in java?

583


Is main an identifier?

546


Can you call a method on a null object?

561






What are the three best choices for a development environment?

602


What is palindrome in java?

558


Differentiate between overriding and overloading cases?

595


Enlist few advantages of inheritance?

580


Can we create constructor in abstract class ?

578


Is jdk required on each machine to run a java program?

748


Can you extend main method in java?

616


Why main() method is public, static and void in java ?

591


What is square root in java?

586


How do you compare two strings lexicographically?

535