Sunday, 20 February 2011

java questions for beginners



Simple java objective type questions and answers for beginners

(1)



public class Loop {

    public static void main(String[] args){

         int i=1;

         int j=5;



         for(;;){

             System.out.println(j>>>i);

         }

    }

}



What will be output of the above java program?



(a)2

   1

(b)2

   1

   0

(c)Infinite loop

(d)Compiler error













Answer:

No comments:

Post a Comment