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 in Java by Shrishti
42 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 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 8, 2018 in Java by geek.erkami
• 2,640 points
419 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,540 points
187 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,880 points
74 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,050 points
153 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,050 points
57 views
0 votes
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,540 points
78 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,880 points
60 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 parth295
• 4,640 points
207 views
0 votes
1 answer

Decompiling Java Class Files

There are a few decompilers out there... ...READ MORE

answered Jun 1, 2018 in Java by Rishabh
• 3,540 points
56 views
0 votes
1 answer

Access method without creating Object

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

answered Feb 7 in Java by Dheeraj
35 views