View Feed
Java Developers
Community of Java Developers: Get Java Programming Help from fellow Java Developers across the world.
654 Members
Join this group to post and comment.
sherya mathur
sherya mathur • Apr 26, 2010

problem based on java programming language

Q:What is multithreading in java programming language and what are the methods
for inter-thread communication and what is the class in which these methods
are defined?
Muti-threading means to divide a particular tasks into many tasks .It is one of the features of java .

The methods for multi-threading are available in thread class or you can also implement a interface named Runnable which provides you methods like run(),init() using that you can create threads according to requirements for your application.
kaniyarasu • Apr 26, 2010
In Java, we can use two way to implement multithreading concept
-->By extending class Thread to our class
-->By implementing Runnable interface to our class

In both method we needs implement functionality of thread in default method called run()

Its signature is: void run(){//here write implementation}

And to invoke run() method call start() method as follows:

It automatically invokes run method...

For some tips just visit: Fruit Spot
sushant005 • Apr 26, 2010
@Shreya Mathur
Q1:What is multithreading in java programming language?
Ans> A thread is defined as the path of execution of a program.It is a sequence of instructions that is executed to define a unique flow of control.
A process that creates two or more threads is called a multithreaded process.
for example:-
An browser like Internet Explorer is multithreaded process,within which you can play video files ,watch animated images at the same time.In a multhitreaded program each thread run at the same time and has a different execution path.
The benefits of multithreading is that we can simultaneously access to multiple applications and minimized the system resource usage.

Q2) what are the methods for inter-thread communication and what is the class in which these methods are defined?

Ans>The java.lang.Thread class is used to access threads in multithreaded application.
A few methods using the thread class are:

1> getPriority():-Returns the priority of a thread.

2> isAlive():- determines whether a thread is running.

3> sleep():-Makes the methodto pause for a periodof time.

4> getName():-Returns the name of the thread.

5> start():-Starts a thread by calling the run() methods.

start(),run() are the Runnable interface to our class.

Share this content on your social channels -