|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.250 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|
Boxing Conversions - 1 (10 Questions)
2) What will be output for the following program?
public class Boxing2 {
public static void main(String[] args) {
byte b = 10;
method(b);
}
static void method(int i){
System.out.println("Primitivae Type call");
}
static void method(Integer i){
System.out.println("Wrapper Type Call");
}
}
1)Wrapper Type Call
2)Primitive Type Call
3)Compiler Error
4)Compiles fine, throws runtime exception
Answer:
2)
2)Primitive Type Call
Explanation :
When comes to method overloading in Java 5.0, it works like the previous versions. First JVM will check for the matching primitive types, then it will search for the Wrapper types.
get more questions on the same topic
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.250 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|
|