DEV Community


Posted on • Originally published at

Which of these class is superclass of every class in java

Overview classes in java:

Today we know about classes and superclass in Java. You may have heard about classes and objects while learning programming language. Many students know a lot about this. And some students are still some students who understand Java as a very difficult programming language and they do not understand the objects and classes at all. Today I will explain to you in very simple words.To create an object, it is necessary to first create its general form with the help of class keywords. Once you have created the structure of the class, then you can create an object of its class type. It's just like you create a structure type structure variable. If you want to call a class member function from within the program that is not part of the class, you first need to name the object and dot operator. Object Oriented Programming Methods Before you start your program, you should have a thorough knowledge of the object used in it and the factors above it. Let's practice and try to understand more.

1.Superclass of every class in Java?
a) String class
b) Object class
c) Abstract class
d) ArrayList class


public class Test {
   public static void main(String args[]){
      Test obj = new Test();
      Class cls = obj.getClass().getSuperclass();

          Output will be:
Enter fullscreen mode Exit fullscreen mode

Top comments (0)