Java Certification Questions 111 -120  «Prev  Next»


Java Queue Questions (122)

  1. How does a PriorityQueue order its elements?

    Answer: A PriorityQueue orders its elements using a user-defined priority?

  2. Which interface does a PriorityQueue implement to impose an ordering other than “natural ordering”?

    Answer:
    The Comparator interface.

  3. What does the T[] syntax represent?

    Answer: This syntax represents an array that is not an array of primitives.

  4. Can the Iterator interface be used with the Map interface?

    Answer: No. The Iterator interface will get an Iterator for a List or a Set.

  5. What are the relative positions of uppercase characters, lowercase characters, and spaces in a natural ordering?

    Answer: Spaces sort before characters and uppercase letters sort before lowercase characters.

  6. What is the difference between NavigableSet and NavigableMap interfaces?

    Answer:
    NavigableSet<E> inherits from Iterable<T> .
    NavigableMap<K,V> inherits from Map<K,V> .

  7. Why were Generics added to the Java language?

    Answer: Collections are the overwhelming reason and motivation for adding generics to the language.

  8. Can you integrate Java 5 and Java 6 generic code with legacy non-generic code?

    Answer: Yes, but most of the errors will occur at run time

  9. How many ways can we track client and what are they?

    Answer:
    The servlet API provides two ways to track client state and they are:
    1. Using Session tracking and
    2. Using Cookies.

  10. What is a characteristic of a non-generic collection?

    Answer:
    A non-generic collection can hold any kind of object. A non-generic collection is quite happy to hold anything that is NOT a primitive.