(a) What will be the output of the following codes:
(i) System.out.println(Math.abs(Math.ceil( -3.2))); [2]
(ii) System.out.println(Character.isLetterOrDigit(‘2’)); [2]
(iii) System.out.println((char) ‘x’+ ‘X’);
Answers
Answered by
1
Answer:
(i) 3
(ii) true
(iii) Ï ( or something like that)
Explanation:
(i) math.ceil(-3.2) will return the nearest and larger int value of it which is -3 and math.abs(-3) will return the absolute value of -3 = 3
(ii) the function returns true if the value in its parenthesis is a letter or a digit otherwise false
(iii) 'x' +'X' = 120+88 = 208 and the char value of 208 is something like Ï
Similar questions