SCJP Module-2 Question-2


 

SCJP Module-2 Question-2

The program given below will help you in understating of java programming and also useful for SCJP

The program given below will help you in understating of java programming and also useful for SCJP

Find the Output Of the Following :

1 .public class LoopOutput{
2. public static void main(String args[]) {
3. int a = 4;
4. int b = 3;
5. int c = 2;
6. for(;b < 7;b++) {
7. if(c++ > a) {
8. a = b + c;
9. }
11. }
12. System.out.println("Value of C is " + c);
13. }
14. }

What is the output of variable "c" after completion of for loop :

1. 1

2. 4

3  6

4. 8

Answer :

(3)

 

Ads