Local class: Use it if you need to create more than one instance of a class, access its constructor, or introduce a new, named type (because, for example, you need to invoke additional methods later). Anonymous class: Use it if you need to declare fields or additional methods.
Read moreHow many types of methods are there in Java class?
There are two types of methods in Java: Predefined Method. User-defined Method.
Read moreWhat are the basic Java questions?
Java Basic Interview Questions
Read moreWhat is a class in Java interview questions?
The Class class is used to represent the classes and interfaces that are loaded by a Java program . The Class class is used to obtain information about an object’s design. A Class is only a definition or prototype of real life object. Whereas an object is an instance or living representation of real life object.
Read moreWhat is local class in Java?
A local class is declared locally within a block of Java code, rather than as a member of a class . Typically, a local class is defined within a method, but it can also be defined within a static initializer or instance initializer of a class.
Read moreWhat are the two types of classes in Java?
Java provides the two types of inner classes are as follows:
Read moreHow do you access class members in Java?
To access the members of a class from other class.
Read more