Wednesday, May 7, 2008

Java Interview Questions 37

181. 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.

182. 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.

183. What is an Iterator interface?
Answer: The Iterator interface is used to step through the elements of a
Collection.

184. 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.

185. 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.

No comments:

Useful Information