Question: What is a transient variable?
Answer: A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.
Answer: A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.
Question: Which containers use a border layout as their default layout?
Answer: The Window, Frame and Dialog classes use a border layout as their default layout.
Answer: The Window, Frame and Dialog classes use a border layout as their default layout.
Question: . How are Observer and Observable used?
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
Question: What is synchronization and why is it important?
Answer: With respect to multi threading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
Answer: With respect to multi threading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
Question: What are synchronized methods and synchronized statements?
Answer: Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
Answer: Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
Question: How are Observer and Observable used?
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
Answer: Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
Question: What is synchronization and why is it important?
Answer: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
Answer: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
Question: What is the Vector class?
Answer: The Vector class provides the capability to implement a growable array of objects What modifiers may be used with an inner class that is a member of an outer class? A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
Answer: The Vector class provides the capability to implement a growable array of objects What modifiers may be used with an inner class that is a member of an outer class? A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
Question: If a method is declared as protected, where may the method be accessed?
Answer: A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
Answer: A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
Question: What is an Iterator interface?
Answer: The Iterator interface is used to step through the elements of a Collection.
Answer: The Iterator interface is used to step through the elements of a Collection.
Question: How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Answer: 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.
Answer: 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.
Question: What is the difference between yielding and sleeping?
Answer: 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.
Answer: 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.
Question: Is sizeof a keyword?
Answer: The sizeof operator is not a keyword.
Answer: The sizeof operator is not a keyword.
Question: What are wrapped classes?
Answer: Wrapped classes are classes that allow primitive types to be accessed as objects.
Answer: Wrapped classes are classes that allow primitive types to be accessed as objects.
Question: How can you write a loop indefinitely?
Answer: for(;;)--for loop; while(true)--always true, etc.
Answer: for(;;)--for loop; while(true)--always true, etc.
Question:. Can an anonymous class be declared as implementing an interface and extending a class?
Answer: An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
Answer: An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
Question: What is the purpose of finalization?
Answer: The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
Answer: The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
Question: Which class is the superclass for every class.
Answer: Object.
Answer: Object.
Question: What is the difference between the Boolean & operator and the && operator?
Answer: If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.
Answer: If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.
Question: What is the GregorianCalendar class?
Answer: The GregorianCalendar provides support for traditional Western calendars.
Answer: The GregorianCalendar provides support for traditional Western calendars.
Question: What is the SimpleTimeZone class?
Answer: The SimpleTimeZone class provides support for a Gregorian calendar.
Answer: The SimpleTimeZone class provides support for a Gregorian calendar.
Question: Which Container method is used to cause a container to be laid out and redisplayed?
Answer: validate()
Answer: validate()
Question: What is the Properties class?
Answer: The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.
Answer: The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.
Question: What is the difference between the paint() and repaint() methods?
Answer: 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.
Answer: 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.
Question: What is the purpose of the File class?
Answer: The File class is used to create objects that provide access to the files and directories of a local file system.
Answer: The File class is used to create objects that provide access to the files and directories of a local file system.
Question: What restrictions are placed on method overloading?
Answer: Two methods may not have the same name and argument list but different return types.
Answer: Two methods may not have the same name and argument list but different return types.
Question: What restrictions are placed on method overriding?
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.
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: What is casting?
Answer: There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
Answer: There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
Question: How are this() and super() used with constructors?
Answer: this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.
Answer: this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.
Question: How is it possible for two String objects with identical values not to be equal under the == operator?
Answer: The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory.
Answer: The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory.
Question: What an I/O filter?
Answer: An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
Answer: An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
Question: What is the Set interface?
Answer: The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
Answer: The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
Question: What is the List interface?
Answer: The List interface provides support for ordered collections of objects.
Answer: The List interface provides support for ordered collections of objects.
Question: What is the purpose of the enableEvents() method?
Answer: The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.
Answer: The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.
Question: What is the difference between the File and RandomAccessFile classes?
Answer: The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
Answer: The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
Question: What interface must an object implement before it can be written to a stream as an object?
Answer: An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
Answer: An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
Question: What is the ResourceBundle class?
Answer: The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.
Answer: The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.
Question: What is the difference between a Scrollbar and a ScrollPane?
Answer: A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
Answer: A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
No comments:
Post a Comment