This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If the code presents an statement that will give compilation error and another statement that might throw runtime error, but question says pick one answer, than what should be answered: Here is the code:
The answer is compilation error at line 14. But I guess there is runtime error at line 13 as well. [ July 15, 2003: Message edited by: Barkat Mardhani ]
Ok, why do you think there's a runtime error? foo() is void, so there's a compiler error, since the second expression of the assertion must return a value. let me know... [ July 15, 2003: Message edited by: Andres Gonzalez ] [ July 15, 2003: Message edited by: Andres Gonzalez ]
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Hi Barkat First if there is only one possible answer select the one that says does not compile. If they want two answers select the other one. But it sounds absurd to ask for a runtime error along with a compilation error. How can you ever have a runtime error when you can not even compile the program. Secondly which error are you talking about. I only encountered an AssertionError(after removing the compilation error). For this question I would say that the answer should be compilation error alongwith any other suitable answer(if any). Runtime error at line 13 is wrong. [ July 15, 2003: Message edited by: Anupam Sinha ]
Joined: Aug 05, 2002
The AssertaionError is the runtime error I am talking about.
Joined: Apr 13, 2003
The answer is compilation error at line 14. But I guess there is runtime error at line 13 as well.
It is not possible for the code to even compile how can it have an AssertionError. [ July 15, 2003: Message edited by: Anupam Sinha ]