Friday 18 February 2011

Primitive data types questions in java


Data type mcq questions of java and answers

(1)



class Datatype {

    public static void main(String[] args) {

         byte num=(byte)130;

         System.out.print(num);

    }

}



What will be the output when you compile and run the above code?

         

(a)130

(b)3

(c)-126

(d)Compiler error











Answer: (c)



(2)



class Datatype {

    public static void main(String[]

No comments:

Post a Comment