Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Sep 2017
    Posts
    227

    What is the use of RUNNABLE interface in java?

    What is the use of RUNNABLE interface in java?

  2. #2
    Senior Member
    Join Date
    Jul 2018
    Posts
    280
    Runnable interface is a type of functional interface which is designed to provide a common protocol for objects that wish to execute code while they are active.

  3. #3

  4. #4
    Registered User
    Join Date
    Apr 2019
    Location
    Bhilai, Chhattisgarh
    Posts
    78
    When you implement Runnable, you can save a space for your class to extend any other class in future or now. When you extends Thread class, each of your thread creates unique object and associate with it. When you implements Runnable, it shares the same object to multiple threads.

  5. #5
    Registered User
    Join Date
    Mar 2019
    Location
    Ahmedabad
    Posts
    180
    1. java.lang.Runnable is an interface that is to be implemented by a class whose instances are intended to be executed by a thread. There are two ways to start a new Thread – Subclass Thread and implement Runnable. There is no need of subclassing Thread when a task can be done by overriding only run() method of Runnable.

      Thus,Runnable interface is a type of functional interface which is designed to provide a common protocol for objects that wish to execute code while they are active.

    2. The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method run. It is used to create thread.

    3. public void run(): is used to perform action for a thread.

  6. #6
    Registered User
    Join Date
    Aug 2019
    Location
    USA
    Posts
    42
    The runnable interface is a type of functional interface designed to provide a common protocol for objects that want to execute code when they are active. The Runnable interface must be implemented by every class whose instances are intended to be executed by the thread. The class must define the method that is run.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.