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 667611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:56:52+00:00 2026-05-13T23:56:52+00:00

I realize that the method run() must be declared because its declared in the

  • 0

I realize that the method run() must be declared because its declared in the Runnable interface. But my question comes when this class runs how is the Thread object allowed if there is no import call to a particular package? how does runnable know anything about Thread or its methods? does the Runnable interface extend the Thread class? Obviously I don’t understand interfaces very well. thanks in advance.

    class PrimeFinder implements Runnable{
         public long target;
         public long prime;
         public boolean finished = false;
         public Thread runner;
         PrimeFinder(long inTarget){
              target = inTarget;
              if(runner == null){
              runner = new Thread(this);
              runner.start()
         }
    }
    public void run(){

    }
}
  • 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-05-13T23:56:52+00:00Added an answer on May 13, 2026 at 11:56 pm

    In this situation, I like to think of interfaces as contracts. By saying that your class implements Runnable, you are explicitly stating that your class adheres to the Runnable contract. This means that other code can create an instance of your class and assign to a Runnable type:

    Runnable r = new PrimeFinder();
    

    Further, by adhering to this contract you are guaranteeing that other code calling your class can expect to find the methods of Runnable implemented (in this case run() ).

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

Sidebar

Related Questions

So this is a purely academic question, mostly as its been a while since
EDIT I actually called object.__new__(cls) , and I didn't realize that by this I
I'm trying to use HashSet to store objects of a class that I created,
Let's say I have a class that allocates some arbitrary member data. There are
I'm processing data from an application that has a few quirks in how it
Edit: Found duplicate I've whittled down some problem code to the simplest working case
Preface: I was thinking the other day about a new database structure for a
I am trying to wrap my head around the rules of applet use. I
Greetings StackOverflowians, As discovered here , Windows 7 features a bug in which the
So as part of problem 17.6 in Think Like a Computer Scientist, I've written

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.