Monday, 14 September 2009

Java Certification Question 0095

Which of the following will compile correctly?

1) short myshort = 99S;
2) String name = 'Excellent tutorial Mr Green';
3) char c = 17c;
4)int z = 015;





Answer

4)int z = 015;

The letters c and s do not exist as literal indicators and a String must be enclosed with double quotes, not single as in this case.

No comments:

Post a Comment