Saturday, February 19, 2011

Looping questions in java


Objective type mcq questions on loops in java and answers



(1)




public class Loop {

public static void main(String[] args) {

Integer a=012,b;

for(b=0;b<=a;b++);

System.out.print(b);

}

}



What will be the output of above java program?



(a)10

(b)11

(c)12

(d) Compiler error











Answer: (b)



(2)



public class Loop {

public static

No comments:

Post a Comment