HI,
consider the following question?
What will be the result of attempting to compile and run the following class?
public class NumberTest
{
public static void main(
String args[])
{
System.out.println(0x10 + 10 + 010);
}
}
Select 1 correct option.
a Compilation error because of the expression 0x10 + 10 + 010.
b When run, the program will print "28 ".
c When run, the program will print "30 ".
d When run, the program will print "34 ".
e When run, the program will print "36 ".
The code compiles fine and when run prints 34 and not "34 ".
but the options herein say that it will print
"<result>
".
and I had seen the same question in another mock wherein they had not used inverted commas in the options.
here I had no other choice so i selected d as answer. but in the real exam we may have some other better choice...
should we expect such questions in the exam? and if yes how to solve those?
Thanx
Sandy