Oracle 1Z0-808 Exam question no. 16

Q.– Given this array:- 

          int [ ]  intArr = { 6, 12, 24, 48, 96 };

Which two code fragments, independently, print each element in this array? 

A) for (int i=0; i < intArr.length ; i++) { 
             System.out.print (i  + " "); 
     }

B) for (int i : intArr) { 
             System.out.print (i + " "); 
     }

C) for (int i ; i < intArr.length ; i++) { 
             System.out.print (intArr[i] + " "); 
     }

D) for (int i=0 : intArr) { 
             System.out.print (intArr[i] + " "); 
             i++;
     } 

E) for (int i=0 ; i < intArr.length ; i++) { 
             System.out.print (intArr[i] + " "); 
     }

F) for (int i : intArr) { 
             System.out.print(intArr[i] + " "); 
    } 


⧪ please give your answer in a comment section.

Post a Comment

6 Comments