JavaBeat
Search JavaBeat

Certification Kits
SCJP 1.5 Exam Questions
SCJP 1.6 Exam Questions
SCWCD 5.0 Exam Questions
SCBCD 5.0 Exam Questions
SCJP 1.6 Links
SCJP 1.6 Home
What is new?
SCJP Books
Objectives
Mock Exams
NavigableSet
NavigableMap
GarbageCollection
Console
Finalize Method
Forums
SCJP Exam Voucher
Certification Links
SCJP 1.4
SCJP 1.5
SCJP 1.6
SCWCD 1.4
SCWCD 5.0
SCBCD 5.0
SCEA
SCEA 5.0
JavaBeat
Home
Articles
Tips
Code
QnA
Forums
400 Mock Questions on 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.

SCJP 1.6 Mock Exams - NavigableSet (14 Questions)

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


package navset;

import java.util.TreeSet;

public class Ques02 {

	public static void main(String[] args) {
		
		MyNavigableSet objects = new MyNavigableSet();
		objects.add(new Object());
		System.out.println(objects);
	}
}


class MyNavigableSet extends TreeSet<String>{

	public boolean add(Object value){
		return super.add(value);
	}
}
  1. The program will compile and run fine to print the contents of the set.
  2. The program will raise a run-time exception telling that it is not possible to add objects of type 'java.lang.Object' in place of 'java.lang.String'.
  3. The program will raise a compile-time error.

Get more questions on NavigableSet

Answer

4) c.

A compile-time error telling that a name-clash has happened for the overridden method taking Object as argument.

400 Mock Questions on 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