What is the immediate superclss of the Applet class

Panel. In Core Java, the immediate superclass of the Applet class is the Panel class. The Applet class extends the Panel class, which, in turn, extends the Container class, and the Container class extends the Component class. Therefore, the class hierarchy looks like this: Object > Component > Container > Panel > Applet So, the … Read more

Can an object’s finalize() method be invoked while it is reachable

An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object’s finalize() method may be invoked by other objects. No, an object’s finalize() method cannot be invoked while the object is reachable. The finalize() method in Java is called by the garbage collector before reclaiming the memory occupied by an … Read more

What restrictions are placed on the location of a package statement within a source code file?

A package statement must appear as the first line in a source code file (excluding blank lines and comments). In Java, the package statement must be the first statement in a Java source file, before any import statements or class declarations. The correct answer to the question about the restrictions on the location of a … Read more

Does garbage collection guarantee that a program will not run out of memory

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection. No, garbage collection in Java does not guarantee that … Read more

What are wrapped classes

Wrapped classes are classes that allow primitive types to be accessed as objects. In Core Java, wrapped classes refer to classes that encapsulate primitive data types within objects. The primary purpose of wrapped classes is to provide a way to use primitive data types as objects. This is often necessary in situations where objects are … Read more