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?
๐Ÿ˜

Replies

  • Manish Goyal
    Manish Goyal
    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
    kaniyarasu
    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:
    start();

    It automatically invokes run method...

    For some tips just visit: All about fruits
  • sushant005
    sushant005
    @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.

You are reading an archived discussion.

Related Posts

i am ad.. new to CE.. here to discuss and get to know new technologies of engineering.. ๐Ÿ˜€
WORLD'S EASIEST QUIZ! (Passing requires only 3 correct answers out of 10!) 1) How long did the Hundred Years' War last ? 2) Which country makes Panama hats ? 3)...
Can someone clearly give the pros and cons of : Newton Raphson, Gauss Seidel and fast decoupled methods in comparison please.๐Ÿ˜’๐Ÿ˜
https://www.orkut.co.in/Main#AlbumZo...272279676&pid=1272304877097$pid=1272304877097 one of my friend has designed so and He's asking me whether it works or not. He has engaged a double acting reciprocating pump with a impeller of turbine....that...
Hello, I'm new to the Forum, so my apologies if this is in the wrong section. I'm designing a retractable arm that will hold an Apple iPad, and need some...