What is the purpose of finalization

The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected. In Java, finalization refers to the process of cleaning up resources or performing some specific actions before an object is garbage-collected. The finalize() method is a method of the Object class, and … Read more

What is the immediate superclass of Menu

MenuItem. In Core Java, the immediate superclass of the Menu class is the MenuItemContainer class. The Menu class is part of the Abstract Window Toolkit (AWT) package in Java, and it extends the MenuItemContainer class. The MenuItemContainer class, in turn, extends the MenuComponent class. So, the inheritance hierarchy is as follows: lua java.lang.Object | +– … Read more

Can an anonymous class be declared as implementing an interface and extending a class

An anonymous class may implement an interface or extend a superclass, but may not be declared to do both. Yes, in Java, an anonymous class can be declared as implementing an interface and extending a class simultaneously. This allows you to create a class on the fly that provides a specific implementation for an interface … Read more

When a thread is created and started, what is its initial state

A thread is in the ready state after it has been created and started. In Java, when a thread is created and started, its initial state is “NEW.” The thread is considered to be in the “NEW” state from the time it is created using the new keyword or by instantiating a class that extends … Read more

What class is the top of the AWT event hierarchy

The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy. In Core Java, the top of the AWT (Abstract Window Toolkit) event hierarchy is the java.awt.AWTEvent class. The AWTEvent class is the superclass for all AWT event classes. It is part of the AWT package and provides a common base class for all types of … Read more