Why Object is Super Class in Java

0 votes
  1. All Java classes extend java.lang.Object
  2. All Java classes cannot extend itself

I wanted to know then how come Object is the superclass for itself?

Feb 6, 2019 in Java by Shrishti
862 views

1 answer to this question.

0 votes

Object is an exception to the first rule, and has no superclass. From JLS3 8.1.4:

The extends clause must not appear in the definition of the class Object, because it is the primordial class and has no direct superclass.

answered Feb 7, 2019 by Dheeraj

Related Questions In Java

0 votes
1 answer

Why the main() method in Java is always static?

As you might know, static here is ...READ MORE

answered May 9, 2018 in Java by geek.erkami
• 2,680 points
2,100 views
0 votes
1 answer

What is the concept of Immutability for strings in Java ? Why are strings immutable ?

According to Effective Java, chapter 4, page 73, ...READ MORE

answered May 11, 2018 in Java by Rishabh
• 3,620 points
1,601 views
0 votes
2 answers

Determining Class of an Object in Java

You can use: Object instance = new SomeClass(); instance.getClass().getName(); ...READ MORE

answered Nov 26, 2018 in Java by Sushmita
• 6,920 points
1,975 views
0 votes
1 answer

What is abstract class in java?

A class that is declared with abstract ...READ MORE

answered Jun 11, 2018 in Java by Daisy
• 8,140 points
963 views
0 votes
2 answers

What is the use of final class in java?

In Java, items with the final modifier cannot be ...READ MORE

answered Oct 5, 2018 in Java by Daisy
• 8,140 points
1,890 views
0 votes
1 answer

what is super keyword in java

In Java, the super keyword is used ...READ MORE

answered Oct 17, 2023 in Java by Rishabh
583 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,620 points
1,326 views
0 votes
2 answers

Does Java allow to create static classes?

Java has "static nested classes", but they ...READ MORE

answered Sep 5, 2018 in Java by Sushmita
• 6,920 points
1,147 views
0 votes
1 answer

Does python have an equivalent to Java Class.forName()?

This is found in the python standard ...READ MORE

answered Jun 1, 2018 in Java by Parth
• 4,640 points
1,453 views
0 votes
1 answer

Access method without creating Object

This is not possible in java. You ...READ MORE

answered Feb 7, 2019 in Java by Dheeraj
4,639 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP