Cracking the Java Coding Interview pdfdrive com


Question JFrame is a heavy weight component. Since it extends an awt


Download 1.48 Mb.
Pdf ko'rish
bet119/182
Sana02.05.2023
Hajmi1.48 Mb.
#1423275
1   ...   115   116   117   118   119   120   121   122   ...   182
Bog'liq
Cracking the Java Coding Interview ( PDFDrive )

Question JFrame is a heavy weight component. Since it extends an awt
Frame, is it Thread Safe? (Swing)
Answer JFrame itself is, since it is just a java.awt.Frame in essence, but the root


Answer JFrame itself is, since it is just a java.awt.Frame in essence, but the root
pane/content pane is not, so it effectively follows the same rules for Swing
containers and is not considered thread safe.
Question What is the difference between invokeAndWait() and
invokeLater()? (Swing)
Answer invokeAndWait() blocks until the Runnable
task is complete; it's synchronous.
invokeLater() posts an action event to the event queue and returns immediately;
it's asynchronous.
Question Why is not recommended to have instance variables in Interface
(Core Java)
Answer By Default, All data members and methods in an Interface are public.
Having public variables in a class that will be implementing it will be violation
of the Encapsulation principal. I hope that's pretty ok..
Question What is the diffrence between inner class and nested class? (Core
Java)
Answer When a class is defined within a scope od another class, then it
becomes inner class. If the access modifier of the inner class is static, then it
becomes nested class.
Question What is a compilation unit? (Core Java)
Answer A compilation unit
is a Java source code file.
Question What restrictions are placed on method overriding? (Core Java)
Answer Overridden methods must have the same name, argument list, and return
type. The overriding method may not limit the access of the method it overrides.
The overriding method may not throw any exceptions that may not be thrown by
the overridden method.
Question How can a dead thread be restarted? (Core Java)
Answer A dead
thread cannot be restarted.
Question What happens if an exception is not caught? (Core Java)
Answer An uncaught exception results in the uncaughtException() method of the
thread's ThreadGroup being invoked, which eventually results in the termination
of the program in which it is thrown.

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   115   116   117   118   119   120   121   122   ...   182




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling