Ron McLeod wrote:According to the documentation Future#get throws InterruptedException and ExecutionException.
Ron McLeod wrote:Maybe, but without knowing the question, its hard to comment any further.
Ron McLeod wrote:Hmm - I'm not sure what is meant by to make the code compile. Obviously to successfully compile the code it needs to be placed in a method inside a class. If the method declares that it throws Exception (or the specific exceptions), line w4 would not need to be changed.
Ron McLeod wrote:Hmm - I'm not sure what is meant by to make the code compile. Obviously to successfully compile the code it needs to be placed in a method inside a class. If the method declares that it throws Exception (or the specific exceptions), line w4 would not need to be changed.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:In the book, it is common to have code snippets. It says in the intro to assume any surrounding code is correct. So you can assume imports/class/method signature. I made just the two changes the explanation suggests in the book and it compiles. Remember that you are assuming the method signature isn't the problem so no need to handle the exception:
Mike Simmons wrote:Note that in Jeanne's code, the main() method now says "throws Exception". Did you add that? Her code has only one method, so she needed "throws Exception" only on that one method. In the code you showed where main() calls f6(), you would need to put "throws Exception" on both methods.
Anil Philip wrote:The actual question in the test bank is like in my post here https://coderanch.com/p/3546743
There is no wrapping method.
Jeanne Boyarsky wrote:In the book, it is common to have code snippets. It says in the intro to assume any surrounding code is correct. So you can assume imports/class/method signature.
Anil Philip wrote:Jeanne,
Do you not get an error on w4?
As I reported in my OP, w4 errors out
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Honk if you love justice! And honk twice for tiny ads!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|