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?
1. package com.udayan.oca;
2.
3. import java.util.ArrayList;
4. import java.util.List;
5.
6. public class Test {
7. public static void main(String[] args) {
8. List
9. list.add(100);
10. list.add(200);
11. list.add(100);
12. list.add(200);
13. list.remove(new Integer(100));
14.
15. System.out.println(list);
16. }
17. }
1. package com.sampleproject.oca;
2.
3. interface Blogger {
4. default void blog() throws Exception {
5. System.out.println("GENERIC");
6. }
7. }
8.
9. class TravelBlogger implements Blogger {
10. public void blog() {
11. System.out.println("TRAVEL");
12. }
13. }
14.
15. public class Test {
16. public static void main(String[] args) {
17. Blogger blogger = new TravelBlogger(); //Line n1
18. ((TravelBlogger)blogger).blog(); //Line n2
19. }
20. }
What will be the result of compiling and executing Test class?
© Copyrights DumpsEngine 2024. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsEngine.