Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.
A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.
A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object’s lock, or by invoking an object’s wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
The operating system’s task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
After a thread is started, via its start() method of the Thread class, the JVM invokes the thread’s run() method when the thread is initially executed.
Yes, it does. The FileNoFoundException is inherited from the IOException. Exception’s subclasses have to be caught first.
When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.
The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don’t know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.
Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.
These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.
The Frame class extends Window to define a main application window that can have a menu bar.
javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
It is used to create objects that provide access to the files and directories of a local file system.
The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
The Class class is used to obtain information about an object’s design and java.lang.Class class instance represent classes, interfaces in a running Java application.
A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.
Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.
It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.
Sub class inherits all the public and protected methods and the implementation. It also inherits all the default modifier methods and their implementation.
If there is a button instance called b1, you may add menu short cut by calling b1.setMnemonic(‘F’), so the user may be able to use Alt+F to click the button.
Yes, just add a main() method to the applet.
AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.
Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.
Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.
When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.
Yes, use this() syntax.
The code sleep(2000); puts thread aside for exactly two seconds. The code wait(2000), causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.
The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.
A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization,
Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.
The Collections API is a set of classes and interfaces that support operations on collections of objects.
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.
Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.
The = operator is right associative.
A break statement results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement.
A private variable may only be accessed within the class in which it is declared.
The purpose of the System class is to provide access to system resources.
The eight primitive types are byte, char, short, int, long, float, double, and boolean.
When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
Component class is the immediate super class.
The Java runtime system generates RuntimeException and Error exceptions.
The garbage collector invokes an object’s finalize() method when it detects that the object has become unreachable.
A dead thread cannot be restarted.
Integer / and % can result in the throwing of an ArithmeticException.
The default value of the boolean type is false.