Question: public class Test { public static void main(String[] args) { int elements = 0; Object [] arr = {A, E, , new Object(), O, U};
![public class Test { public static void main(String[] args) { int](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f95427e9bdb_03966f9542777855.jpg)
![elements = 0; Object [] arr = {A, E, \, new Object(),](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f954288d7eb_04066f9542827dfb.jpg)
public class Test { public static void main(String[] args) { int elements = 0; Object [] arr = {A, E, \, new Object(), O, U}; //Line n1 for(Object obj : arr) { //Line n2 if(obj instanceof String) { = continue; } else { break; } elements++; //Line n3 } System.out.println(elements); //Line n4 } } What will be the result of compiling and executing Test class? Compilation error at Line n1 Compilation error at Line n2 Compilation error at Line n3 O Compilation error at Line n4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
