Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:42:01+00:00 2026-06-14T06:42:01+00:00

I have a java class SomeClass implements Runnable Which has a method display(). When

  • 0

I have a java class

SomeClass implements Runnable

Which has a method display().

When I create a thread of this class

Thread thread1 = new Thread(new SomeClass());

Now how I can call the display() method using the thread instance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:42:03+00:00Added an answer on June 14, 2026 at 6:42 am

    You will end up calling start() on thread1.

    SomeClass will override run() method which in turn need to call display() method.

    This way when you call start(), run method of SomeClass() object will be invoked and display() method will be executed.

    Example:

    public class SomeClass implements Runnable {
        private List yourArrayList;
        public void run() {
            display();
        }
    
        public void display() {
            //Your display method implementation.
        }
       public List methodToGetArrayList()
       {
        return  yourArrayList;
       }
    }
    

    Update:

    SomeClass sc = new SomeClass()
    Thread thread1 = new Thread(sc);
    thread1.join();
    sc.methodToGetArrayList();
    

    NOTE: Example is to illustrate the concept, there may be syntax errors.

    If you don’t use join(), as Andrew commented, there may be inconsitence in results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to learning JSPs and Servlets. I have a Java class which calls
I have a class like this public SomeClass { private List<string> _strings = new
I have seen Java code that says something like: SomeClass.this.someMethod(someArg); Blah(AnotherClass.class); Blah(YAClass.this); What do
I have a Java class which handles both single valued and multi-valued data. Therefore,
If I have a java class which is package-private (declared with class, not public
Since Java 1.4 doesn't have enums I'm am doing something like this: public class
I've got a question regarding multiple-thread method invocation in Java. Let's say we have
If I have a class SOmeClass, with a method someMethod, in the following code
I am new to java. My question is what is thread wrapper class for
Let's say I have some Java code: public class SomeClass { static { private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.