Friday, February 18, 2011

Conditional operator questions in java


Questions on conditional operators in java and answers


(1)



public class Conditional {

public static void main(String[] args) {

int a=5;

Integer b=10;

int c=++a>++b?++a:++a+b;

System.out.print(c);

}

}



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



(a)16

(b)17

(c)18

(d)19











Answer: (c)



(2)



public

No comments:

Post a Comment