-
-
-
-
-
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8characters
Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set usesonly 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.
-
What is a task's priority and how is it used in scheduling
A task's priority is an integer value that identifies the relative order in which it should beexecuted with respect to other tasks. The scheduler attempts to schedule higher prioritytasks before lower priority tasks.
-
In which package are most of the AWT events that support the event-delegationmodel defined
Most of the AWT-related events of the event-delegation model are defined in thejava.awt.event package. The AWTEvent class is defined in the java.awt package.
-
What is the advantage of the event-delegation model over the earlier eventinheritancemodel
The event-delegation model has two advantages over the event-inheritance model. First,it enables event handling to be handled by objects other than the ones that generate the events (or their containers). This allows a clean separation between a component's designand its use. The other advantage of the event-delegation model is that it performs muchbetter in applications where many events are generated....
-
How are Java source code files named
A Java source code file takes the name of a public class or interface that is defined withinthe file. A source code file may contain at most one public class or interface. If a publicclass or interface is defined within a source code file, then the source code file must takethe name of the public class or interface. If no public class or interface is defined within asource code file, then the file...
-
What is the relationship between the Canvas class and the Graphics class
A Canvas object provides access to a Graphics object via its paint() method.
-
What is an object's lock and which object's have locks
An object's lock is a mechanism that is used by multiple threads to obtain synchronizedaccess to the object. A thread may execute a synchronized method of an object only afterit has acquired the object's lock. All objects and classes have locks. A class's lock isacquired on the class's Class object.
-
How are the elements of a BorderLayout organized
The elements of a BorderLayout are organized at the borders (North, South, East, andWest) and the center of a container.
-
When can an object reference be cast to an interface reference
An object reference be cast to an interface reference when the object implements thereferenced interface.
-
How is rounding performed under integer division
The fractional part of the result is truncated. This is known as rounding toward zero.
-
What classes of exceptions may be caught by a catch clause
A catch clause can catch any exception that may be assigned to the Throwable type. Thisincludes the Error and Exception types.
-
What is the relationship between an event-listener interface and anevent-adapter class
An event-listener interface defines the methods that must be implemented by an eventhandler for a particular kind of event. An event adapter provides a default implementationof an event-listener interface.
-
What restrictions are placed on the values of each case of a switch statement
During compilation, the values of each case of a switch statement must evaluate to avalue that can be promoted to an int value.
-
How are the elements of a GridBagLayout organized
The elements of a GridBagLayout are organized according to a grid. However, theelements are of different sizes and may occupy more than one row or column of the grid.In addition, the rows and columns may have different sizes.
-
What advantage do Java's layout managers provide over traditional windowingsystems
Java uses layout managers to lay out components in a consistent manner across allwindowing platforms. Since Java's layout managers aren't tied to absolute sizing andpositioning, they are able to accomodate platform-specific differences among windowingsystems.
-
When is the finally clause of a try-catch-finally statement executed
The finally clause of the try-catch-finally statement is always executed unless the threadof execution terminates or an exception occurs within the execution of the finally clause.
Java Interview Questions
Ans