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.
Do'stlaringiz bilan baham: