Java Programming - Flow Control - Discussion
Discussion Forum : Flow Control - Finding the output (Q.No. 21)
                   
                                       
                                21.
What will be the output of the program?
 
                                    int I = 0;
label:
    if (I < 2) {
    System.out.print("I is " + I);
    I++;
    continue label;
}
Answer: Option
                                                    Explanation:
                                                The code will not compile because a continue statement can only occur in a looping construct. If this syntax were legal, the combination of the continue and the if statements would create a kludgey kind of loop, but the compiler will force you to write cleaner code than this.
Discussion:
15 comments Page 2 of 2.
                
                        Dipika said: 
                         
                        9 years ago
                
                @Ruba.
The Output is:
 
5
0
                The Output is:
5
0
                        Paparao said: 
                         
                        9 years ago
                
                What is a label? What is its function?
                
                     (1)
                
            
                        Uday said: 
                         
                        8 years ago
                
                @Ramu.
The answer is 212.
                The answer is 212.
                        Atul said: 
                         
                        8 years ago
                
                Yes @Uday. 
1 2 6 30 60 130 (212)
1 4 24 30 70 82
3 20 6 40 12
                1 2 6 30 60 130 (212)
1 4 24 30 70 82
3 20 6 40 12
                        Raj Patel said: 
                         
                        7 years ago
                
                I think label is only for a loop. Am I right?
                Post your comments here:
 
            
        Quick links
                            Quantitative Aptitude
                                    
                                    Verbal (English)
                                    
                                    Reasoning
                                    
                                Programming
                                    
                                    Interview
                                    
                                     Placement Papers