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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:45:24+00:00 2026-06-15T17:45:24+00:00

Possible Duplicate: What is an interface in Java? I have experience with object languages

  • 0

Possible Duplicate:
What is an interface in Java?

I have experience with object languages and object paradigm, but I have one doubt about “implements” statement. Doubt is does it includes code (functionality)? So to be very specific Does “MyClass implements XInterface” include code from other classes that implement that interface?

Class inheriting is simple including code, in a way, I know “including” may not be right word but that is what is talking place when you use “extends”. You include functionality from parent class.

So let use Runnable interface for example. It has only one run() deceleration. Which could mean nothing, just that MyClass will have implementation of run(). And that what confuses me, like implementing one line deceleration in some file will make me some good… where is the actual functionality (and code) that I will get by using “implements”? So if I use:

MyClass implements Runnable {}

Runnable obj = new (Runnable) MyClass();

obj.run();//will call run() implementation from MyClass
obj.otherFunctions();/* so this calls functions from other classes that implement interface, but I don't know what functions from other classes are implementing, or even do I need them?*/

Also do I have to have one class per thread, like MyClass extends Thread implements Runnable ?

  • 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-15T17:45:25+00:00Added an answer on June 15, 2026 at 5:45 pm

    A class Cl that implements an Interface means that all methods that are defined in the interface must be implemented in class Cl. The calling class then can call these methods, because it is known that Cl implements (fullfills) the interface.

    For example see the List interface: ArrayList and LinkedList both implement List, they have the same public methods (e.g add(), get()), but are internally working different.

    List list = new ArrayList();
    list.add(3);
    

    later if somebody wants ArrayList to be exchanged by another class, that also implements List, only one line has to be exchanged

    List list = new LinkedList();
    list.add(3);
    

    If programming to Interfaces the code is less dependent on a specific class. this has advantages when you later want to exchange one class for e,g purpose of testing, where you could controll that class by a test case.

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

Sidebar

Related Questions

Possible Duplicate: Creating an “object” of an interface I am new to Java. Based
Possible Duplicate: Why would one declare a Java interface method as abstract? I found
Possible Duplicate: MouseListener needs to interact with many object Java I have a program
Possible Duplicate: Why does Eclipse complain about @Override on interface methods? I have some
Possible Duplicate: Why should the interface for a Java class be prefered? When should
Possible Duplicate: Interface defining a constructor signature? I have a mixed hierarchy of classes
Possible Duplicate: Method name collision in interface implementation - Java What do we do
Possible Duplicate: Java Interfaces? What is the use of interface in java? Is interface
Possible Duplicate: Java's Interface and Haskell's type class: differences and similarities? When I started
Possible Duplicate: Interfaces with static fields in java for sharing ‘constants’ We have constants

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.