JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA
400 Mock Questions on OCPJP 6 (formerly known as SCJP 1.6)
JUST Rs.300 or 10 USD Send us mail to sales@javabeat.net
more details
Do you have paypal account? Click Here to pay now and get the questions.

OCPJP 6 Mock Exams - NavigableMap (10 Questions)

2) What will be the output of the following program?


package navmap;

import java.util.HashMap;
import java.util.NavigableMap;
import java.util.TreeMap;

public class Ques01 {

	public static void main(String[] args) {
		
		NavigableMap<String, String> colors = new HashMap<String, String>();
		
		colors.put("RED", "Red");
		colors.put("BLUE", "Blue");
		System.out.println(colors.get("BLUE"));
	}
}
  1. The program will output 'null'.
  2. The program will return 'Blue'.
  3. The program won't compile because of compilation errors.
  4. The program will throw a run-time exception.

Get more questions on NavigableMap

Answer

2) c.

The program won't compile since the class HashMap doesn't implement the NavigableMap interface.

400 Mock Questions on OCPJP 6 (formerly known as SCJP 1.6)
JUST Rs.300 or 10 USD Send us mail to sales@javabeat.net
more details

JavaBeat Website (2004-2008), India
javabeat | about us | useful resources
Copyright (2004 - 2008), JavaBeat