answersLogoWhite

0

Threads in java

Updated: 8/19/2019
User Avatar

Wiki User

12y ago

Best Answer

Yes, java supports threaded execution. Threads can be created explicitly by constructing and starting a Thread object; or implicitly by running in a managed environment. For instance: a web server typically runs a thread for each http connection.

Java has specific constructs for threading: the "synchronized" and "volatile" language keywords, and the "wait" and "notify" methods on the base object class. Additionally, there are objects in the standard class libraries such as threadsafe collections and higher-level mutex utility objects.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

In Java, "thread" means:

• A thread of execution

A thread of execution is an individual process that has its own call stack. In Java, there is one thread per call stack or, to think of it in reverse, one call stack per thread. Even if you don't create any new threads in your program, threads are there running without your knowledge.

If you are curious and ask me how? Just stop for a moment and think how you would execute a java program? You'll write a main method and then execute it from the command line using the "java" command. Well, you have already answered the question because, when your main method starts, the JVM assigns a thread for this main method and assigns it a call stack. So, eventhough you did not intentionally create a thread, the system did one for you.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Threads in java
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


In relation to Java what is a thread?

A Java Thread is a thread of execution in a Java Program. A Java Virtual Machine can have a single application running multiple threads, which is known as concurrency. Threads are what make the program run. Each thread has a different priority, and when the machine queue fills up, the threads are executed in the order of their priority.


Where can one find out how to implement threads using Java?

You can find out how to implement threads using Java through Stacker Overflow, Java Script Source, Java Code Geeks, Free Programming Resources and other websites. There are also tutorials on college sites as well as Youtube.


Where can one find information about Java threads?

There is a lot of information about Java threads. The local library has many books on this topic. Also, websites like Oracle and O'Reiley have information on this topic for the public.


What java interface must be implemented by all threads?

Runnable interface


Why java called as multithreaded programming?

Java is called multithreaded because it allows the programmer to define multiple threads of execution manually. The main program would continue to execute as one thread and we can speed up the processing by declaring individual threads. Threads in Java can be created in two ways: 1. By extending the Thread class & 2. By implementing the Runnable interface


Why is single thread system not used in java?

Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.


What mean by multithreaded program?

A multithreaded program is one that has multiple threads in execution. They may execute parallel to one another or totally without relation to one another. In Java you can create multithreaded programs using Java threads.


Why thread used in java?

Threads are used in Java to run multiple operations in parallel. You can create and run multiple threads in parallel to utilize the processing power of the computer and reduce waiting time which would be high if processes are executed in sequence


What is java is so popular?

java is a machineindependent programming language. It is simple. Only java supports applets and servelets . It is completely object oriented and highly secure . It contains threads that can programing easily.


Compare and contrast between threads and classes in java language?

A thread is like any other class, except that there is the capacity to run multiple threads - multiple processes - simultaneously.


What is volatile thread?

Threads are not volatile. The volatile is a keyword that is used while having multiple threads in a Java Program. This keyword is used when multiple threads access a particular variable but still it is not mandatory to synchronize or prevent access to that variable.