|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 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 5.0 Objective - 7(10 Questions)
1) What will be the output of the following program when it is made to run with the options "java scjp5_0.chap07.Ques01 1"
package scjp5_0.chap07;
public class Ques01 {
public static void main(String[] args) {
for (int i = 0; i < 2; i ++){
try{
System.out.println(args[i]);
}catch(Exception e){}
}
}
}
- The program will output 'scjp5_0.chap07.Ques01 1'.
- The program will output 1.
- The program will output '1' and then will raise an ArrayIndexOutOfBoundsException.
- The program won't print anything but will raise an ArrayIndexOutOfBoundsException at run-time.
Answer
1) b.
The array 'args' would be of length 1 and attempting to access the second element will raise an ArrayIndexOutOfBoundsException, however, since the exception is handled, the program will run fine by printing 1.
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|