Share on Google+Share on Google+

SCJP Module-2 Question-2

Advertisement
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)

 

Advertisements

Posted on: July 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.