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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:51:09+00:00 2026-05-25T22:51:09+00:00

Does any Java Interface implicitly implements java.lang.Object? This question arose when I did something

  • 0

Does any Java Interface implicitly implements java.lang.Object?

This question arose when I did something like this:

public static String[] sizeSort(String[] sa) {

Comparator<String> c = new Comparator<String>() {
            public int compare(String a, String b) {
                if (a.length() > b.length()) return 1; 
                else if (a.length() < b.length())
                    return -1;
                else 
                    return 0;
                 }
        };

// more code

}

It worked fine even though I did not implement equals method of this interface.
Your answers clears this up. But does any one know if above is anonymous local inner class or named local inner class?

  • 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-25T22:51:10+00:00Added an answer on May 25, 2026 at 10:51 pm

    Sort of. Citing the Java Language Specification:

    If an interface has no direct
    superinterfaces, then the interface
    implicitly declares a public abstract
    member method
    m with signature s,
    return type r, and throws clause t
    corresponding to each public instance
    method
    m with signature s, return type
    r, and throws clause t declared in
    Object
    , unless a method with the same
    signature, same return type, and a
    compatible throws clause is explicitly
    declared by the interface. It is a compile-time error if the interface explicitly
    declares such a method m in the case
    where m is declared to be final in
    Object.

    Note that Object has a number of final and protected methods that all interfaces “inherit” this way, and you couldn’t have those modifiers in an interface (which would be implied by your “implements java.lang.Object”).

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

Sidebar

Related Questions

Does something like this make any sense at all in Java? class A<T extends
Is there any Java function or util class which does rounding this way: func(3/2)
Does anyone have any good suggestions for creating a Pipe object in Java which
Does anyone have any experience with doing this? I'm working on a Java decompiler
Is there any functionality in Java for pausing the program like system(PAUSE); does in
I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public
Are there any CI-Systems for Delphi like Hudson for Java? Does Hudson has any
I'd like to be able to annotate a public class/interface in Java as @NonPublic
Why does the java.util.Set interface lack get(int Index) , or any similar get() method?
I have this structure: ///Creep.java/// public interface Creep extends Movable<Position2D> { ... } ///Movable.java///

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.