Special Offer! Sale of the Month | Extra 20% OFF - Ends In Coupon code: TEL20
Stay ahead with 100% Free Java SE 8 Programmer I 1Z0-808 Dumps Practice Questions
Given:
What will be the result of compiling and executing Test class?
1. //Test.java
2. package com.udayan.oca;
3.
4. import java.io.FileNotFoundException;
5.
6. public class Test {
7. public static void main(String[] args) {
8. try {
9. System.out.println(1);
10. } catch (NullPointerException ex) {
11. System.out.println("ONE");
12. } catch (FileNotFoundException ex) {
13. System.out.println("TWO");
14. }
15. System.out.println("THREE");
16. }
17. }
What will be the result of compiling and executing Test class?
package com.udayan.oca;
public class Test {
public static void main(String[] args) {
m1(null);
}
static void m1(CharSequence s) {
System.out.println("CharSequence");
}
static void m1(String s) {
System.out.println("String");
}
static void m1(Object s) {
System.out.println("Object");
}
}
Consider below code of Test.java file:
1. package com.sampleproject.oca;
2.
3. public class Test {
4. public static void main(String[] args) {
5. String [][] arr = { {"%", "$$"}, {"***", "@@@@", "#####"}};
6. for(String [] str : arr) {
7. for(String s : str) {
8. System.out.println(s);
9. if(s.length() == 4) //Line n1
10. break; //Line n2
11. }
12. break; //Line n3
13. }
14. }
15. }
What will be the result of compiling and executing Test class?
What will be the result of compiling and executing Test class?
package com.udayan.oca;
public class Test {
static String msg; //Line 2
public static void main(String[] args) {
String msg; //Line 4
if(args.length > 0) {
msg = args[0]; //Line 6
}
System.out.println(msg); //Line 8
}
}
© Copyrights TheExamsLab 2025. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the TheExamsLab.