Home
21.
What is recursion ?

As we know, a method usually invokes another method. A method can also invoke itself. Such a method is known as recursive method.

22.
Tell me about Local class.

A local class is declared locally within a block of Java code rather than as a member of a class Only classes may be defined locally: interfaces, enumerated types, and annotation types must be top-level or static member types. 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.

23.
Explain Abstract class ?

A class for which we cannot create objects is called an abstract class. A abstract class is to be extended and then instantiated.

Some of the methods in an abstract class may be declared as abstract methods. Such an abstract method consists of a declaration without any body, as shown below:

             abstract class test11
             {
             abstract int numtest();
             
             }         
All abstract methods that are declared in an abstract class should be implemented by the class that extends this abstract class. Other wise that subclass itself should be declared as abstract.

24.
What is the difference between static and non-static variables?

A static variable is associated with the whole class instead of a specific instances of a class. But a Nonstatic variables take on unique values with each object instance.

25.
What are the types of swing components ?

Swing components are divided into three categories .There are Container components, Ordinary components, Menu components.