Interviews - C# Corner

Rohit Gupta
What are the types of Classes in Java?
By Rohit Gupta in Java onSep 10 2019
  • Vijay Kumari
    Sep, 2019 16

    In Java, There are 4 major types of classes.

    1. Abstract Java Classes
      Abstract Java class can have abstract methods and non-abstract methods.
      If a class have an abstract method, this class must be abstract Java class.
      If we want to use an abstract class, it needs to be extended and its methods implemented.

    2. Nested Java Classes
      Java programming language allows you to define a class within another class. We use the nested class to logically group of the class and interface in one place It can be more readable maintainable and can access all the members of the outer class(public, private, protected).

    3. Final Java Classes
      When we use the final with any class, it is called a final Java class. A final class can’t be inherited. If any class is declared final then all its methods implicitly get declared as final.

    4. Singletan Java class

    In object-oriented programming, a singleton class is a class that can have only one object at a time. Singletons often control access to resources, such as database connections or sockets. The intention is to create a single instance of an object of classes which are expensive to create during runtime and try to reuse the same object.

    For a Detailed tutorial on Java Classes, visit
    https://www.c-sharpcorner.com/article/a-complete-java-classes-tutorial/

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS