R Kumar

Greenhorn
+ Follow
since Jul 11, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by R Kumar

Hi. The following code is taken from the javabeat mock exams.

Given:

1. import java.util.*;
2. public class Fruits {
3. public static void main(String [] args) {
4. Set c1 = new TreeSet();
5. Set o1 = new TreeSet();
6. bite(c1);
7. bite(o1);
8. }
9. // insert code here
10. }
11. class Citrus { }
12. class Orange extends Citrus { }

Which, inserted independently at line 9, will compile? (Choose all that apply.)

A). public static void bite(Set<?> s) { }
B). public static void bite(Set<Object> s) { }
C). public static void bite(Set<Citrus> s) { }
D). public static void bite(Set<? super Citrus> s) { }
E). public static void bite(Set<? super Orange> s) { }
F). public static void bite(Set<? extends Citrus> s) { }
G). Because of other errors in the code, none of these will compile.


According to me A,B,C,D,E,F are all correct

But the answer mentioned is A,E,F are correct. Could anyone please clarify?
Thanks all. This question is from the John Meyer's mock exam for scjp5. I guess there is some mistake in the question itself because the null option has not even been specified
hi all. I came across the following code in one of the mock tests

public class Testing123 {

public static void main(String... args)
{
Number[]na = new Integer[3];
System.out.println(na[0]);
}
}

a)0
b)some garbage
c)3
d)compilation fails

the correct answer is supoosed to be compilation fails but when i tried this code it simply works fine and prints null..

could anyone tell wots wrong?
It could be better if you also mention what you think are the right answers.According to me following are the correct answers. If they are wrong please correct me..

Question 13: h
Question 46: targetObject instanceof Runnable
Question 47: nothing
Question 55: The program compiles but when you try to run the interpreter complains that it cannot find the main() method it needs to run.
Hi Raj
Could you manage to get the whizlab kit for Rs.750/-..I too was able to see the discounted price as 44.95$..If so please let me know so I can purchase it too.
Thanks