-
-
-
-
-
How are Observer and Observable used
Objects that subclass the Observable class maintain a list of observers. When anObservable object is updated it invokes the update() method of each of its observers tonotify the observers that it has changed state. The Observer interface is implemented byobjects that observe Observable objects.
-
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 ispossible 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
-
If a variable is declared as private, where may the variable be accessed
A private variable may only be accessed within the class in which it is declared.
-
How does multithreading take place on a computer with a single CPU
The operating system's task scheduler allocates execution time to multiple tasks. Byquickly switching between executing tasks, it creates the impression that tasks executesequentially.
-
Which package is always imported by default
The java.lang package is always imported by default.
-
What is the purpose of garbage collection
The purpose of garbage collection is to identify and discard objects that are no longerneeded by a program so that their resources may be reclaimed and reused.
-
What modifiers may be used with a top-level class
A top-level class may be public, abstract, or final.
-
-
-
-
-
-
-
-
What is the Locale class
The Locale class is used to tailor program output to the conventions of a particulargeographic, political, orcultural region.
-
Java Interview Questions
Ans