Sunday 13 February 2011

Java question answer


java question papers answers for mca ,bca and diploma

(1)


public class Loop {


    public static void main(String[] args){


         int i=0;


         boolean b=true;


         for(i++;b;i++)


         {


             System.out.println(~i);


             b^=true;


         }


    }


}


What will be output of above program?


(a)-2


(b)-3


(c)Infinite loop


(d)Compiler error


No comments:

Post a Comment