aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes two possible answers Q18 ch 4 page 282 from KB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "two possible answers Q18 ch 4 page 282 from KB " Watch "two possible answers Q18 ch 4 page 282 from KB " New topic
Author

two possible answers Q18 ch 4 page 282 from KB

Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
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 ]
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
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
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
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 ]
Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
The AssertaionError is the runtime error I am talking about.
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
Hi Barkat
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: two possible answers Q18 ch 4 page 282 from KB
 
Similar Threads
Confusing Assertions Question
Assertion Question
Assertion topic
Assertion
Qn on assertion.