answersLogoWhite

0

Define the concepts of threads.

User Avatar

Anonymous

16y ago
Updated: 8/17/2019

The Java language includes a powerful threading facility built into the language. You can use

the threading facility to:

· Increase the responsiveness of GUI applications

· Take advantage of multiprocessor systems

· Simplify program logic when there are multiple independent entities

· Perform blocking I/O without blocking the entire program

You can create Threads in Java using two ways - Implementing the Runnable Interface or by Extending the Thread class

A Sample Thread program:

public class TwoThreads {

public static class Thread1 extends Thread {

public void run() {

System.out.println("A");

System.out.println("B");

}

}

public static class Thread2 extends Thread {

public void run() {

System.out.println("1");

System.out.println("2");

}

}

public static void main(String[] args) {

new Thread1().start();

new Thread2().start();

}

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Over the last 40 years the concepts that define culture have?

shifted dramatically


How does Rig Veda define the basic Hindu religious concepts?

it is because it doesn't matter


Which statement is true about the concept of ethnicity?

(For Apex Learning) It is based on shared concepts that people define for themselves.


What are different concept of god?

Differing concepts of God is explained by the diverse beliefs held by followers of various religious persuasions. There are different concepts that clearly define one religion from another and then there are conflicting concepts within particular beliefs.


What you know of mapmaking terms and concepts and word parts define hemisphere in your own words?

Hemisphere is half of a sphere.


What Is The Importance Of Limits And Continuity?

Those are among the most fundamental concepts in calculus; they are used to define derivatives and integrals.


How would you define the word paradigm?

A metaparadigm is the broadest perspective of the discipline, a way to describe the concepts that concern the profession or domain. The metaparadigm for nursing describes those concepts that define the discipline of nursing. Since the early 1970's, four concepts (person, health, nursing, and environment) have been considered essential in describing the parameters of the profession.


What is a straght in math?

There is no such thing as "Straght" in math: the word does not [yet] exist in the English language. It is not easy to define "staright". You start off with a set of primitive mathematical concepts and then define other concepts using them. A straight line is a primitive geometric concept: it is the shortest distance between two distinct points in a plane. [You will probably need to use the concept of straight to define shortest!]


What is the mechanism of earthquake?

The animation on this page shows the main concepts that define a seismic event, as well as some of the consequent effects.


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


What equation represents a function?

A function tries to define these relationsips. It tries to give the relationship a mathematical form. An equation is a mathematical way of looking at the relationship between concepts or items. These concepts or items ar represented by what are called variables.


What do the circles represent how do they functions?

Circles can represent various concepts such as unity, wholeness, infinity or cycles. In mathematics, circles are a set of points equidistant from a central point. They are used to define geometric shapes, equations, and concepts in geometry and trigonometry.