What are different types of Classes available in Java?


Posted On: Dec 18, 2020


Different types of Classes available in Java are as follows:

  1. Concrete class
  2. Abstract class
  3. Final class
  4. Static class
  5. Inner Class

Concrete class

In Java, A concrete class is a type of subclass, which implements all the abstract methods of its super abstract class from which it extends.

Abstract class

In Java, An abstract class is a type of class. An abstract class is declared by the abstract keyword. An abstract class cannot be instantiated directly. An abstract class can be instantiated either by a concrete subclass or by defining all the abstract methods along with the single statement that has no definition or body. It may or may not contain an abstract method. If a class contains an abstract method, then it also needs to be an abstract method.

Final class

A class declared with the final keyword is a final class and it cannot be extended by another class.

Static class

Static classes in Java are allowed only for inner classes which are defined under some other class,as static outer class is not allowed which means that we can't use static keywords with outer class.

Inner Class

A class declared within another class or method is called an inner class.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    HCL Java Developer Interview Questions

    What is Multithreading in Java?

    Multithreading is a programmable approach to achieve multitasking. Multithreading in Java is a process of executing multiple threads cumulatively. A thread is the smallest unit of processing which is ...

    HCL Java Developer Interview Questions

    What use of intern() method in String?

    In Java, intern() is a native method of the String class. The String.intern () returns a reference to the equal string literal present in the string pool. The intern () method is applicable to String ...

    HCL Java Developer Interview Questions

    What is Collection Framework?

    A Java collection framework is an architecture that was added to Java 1.2 version. The Collection Framework provides a well-designed set of classes and interfaces for storing and manipulating a group ...