Home Tutorial Java Scjp Part5 SCJP Module-5 Question-10

 
 

Share on Google+Share on Google+
SCJP Module-5 Question-10
Posted on: July 12, 2010 at 12:00 AM
Advertisement
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)

Advertisement

Related Tags for SCJP Module-5 Question-10:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 12, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com