![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the super class of every class in Java?
The class named Object is the super class of every class in Java.
Let’s test it with an example. The java.lang.Class.getSuperclass() returns the Class representing the superclass of the entity (class, interface, primitive type or void) represented by this Class.
So, Create a sample concrete class and lets try to get the name of its super class using this method.
Example
public class Test { public static void main(String args[]){ Test obj = new Test(); Class cls = obj.getClass().getSuperclass(); System.out.println(cls.getName()); } }
Output
Since the Object class is the super class of all classes it displays the name of the object class as shown below.
java.lang.Object
Advertisements