Home Tutorial Java Scjp Part2 SCJP Module-2 Question-2

 
 

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

 

Advertisement

Related Tags for SCJP Module-2 Question-2:


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 6, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com