SCJP Module-5 Question-10


 

SCJP Module-5 Question-10

The program given below tests your understanding and logic of for loop in Java and for preparation for SCJP examination.

The program given below tests your understanding and logic of for loop in Java and for preparation for SCJP examination.

Given a sample code:

1    public class Test{
2    public static void main(String args[]) throws Exception{
3    for (int i = 5;i < 8;i++){
4    for (int j = 5;j < 8;){
5    System.out.print(i);
6    System.out.print(j+" ");
7    break;
}}
}}

What will be the result of above code ?

(1) Compilation fails at line number 4.
(2) 55 65 75
(3) 5 6 6
(4) 55 66 77

Answer:

(2)

Ads