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

  • Home
  • SEARCH
  • 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 8790045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:33:08+00:00 2026-06-13T22:33:08+00:00

I have two classes, and I would like for my second class to acces

  • 0

I have two classes, and I would like for my second class to acces private data from the first class.

Normally I’d have:

public class GenericDictionary<T> implements GenericDictionary_interface<T> {

public class Iterator<T> extends GenericDictionary<T> {

But I have an interface, I don’t EXACTLY know how they work, sometimes they seem to not be necessary.

public class Iterator<T> implements Iterator_interface<T> {

How can I extend another class and have an interface ? Is the interface not needed ? should the interface of my Iterator<T> class be in the supper’s interface ? If so … how ?

P.S. please don’t lecture me on why I’m doing what I’m doing (aka making my own stuff instead of using the ones in java.util.*)

EDIT: Even though I decided to go with inner classes, the answer to my question is the order of extends and implements, thank you.

  • 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-13T22:33:09+00:00Added an answer on June 13, 2026 at 10:33 pm

    How can I extend another class and have an interface ?

    You put the extends first, then the implements:

    public class Iterator<T>
        extends GenericDictionary<T>
        implements Iterator_interface<T>
    {
    

    For example, in the JDK, java.util.ArrayList is given as

    public class ArrayList<E>
    extends AbstractList<E>
    implements List<E>, RandomAccess, Cloneable, Serializable
    

    (See its Javadoc.)

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

Sidebar

Related Questions

I have two classes class PopulationMember { public: void operationOnThisMember1(); void operationOnThisMember2(); ... private:
I have two classes that I would like to merge into a composite. These
I have two classes Invoice and InvoiceItem. I would like Invoice to have a
I have implemented two classes, isbn10 and isbn13. I would like to create a
I have two classes (MVC view model) which inherits from one abstract base class.
I have two classes, one that inherits from the other. The base class is
I have two entity classes: public class Invoice { public int ID { get;
I have two classes that I would like to transform to protobuf messages: [ProtoContract]
Thank you for reading, I have two classes with two propertys. I would like
I have two separate web services, the first configured to extract data from a

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.