Look at this question:
public class TestClass {
public static void doStuff() throws Exception{
System.out.println("Doing stuff...");
if(Math.random()>0.4){
throw new Exception("Too high!");
}
System.out.println("Done stuff.");
}
public static void main(String[] args) throws Exception {
doStuff();
System.out.println("Over");
}
}
The program says that the correct answers are:
Doing stuff...
Exception in thread "main" java.lang.Exception: Too high!
at TestClass.doStuff(TestClass.java:29)
at TestClass.main(TestClass.java:41) Agreed
AND
Doing stuff...
Done stuff. Not agreed
My point is: if the program reaches the "Done stuff", isn't it obligated to run the "Over"?
About Question enthuware.ocajp.i.v7.2.846 :
Moderator: admin
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.846 :
Yes, and Over is indeed a part of correct option 3.
HTH,
Paul,
HTH,
Paul,
Who is online
Users browsing this forum: Bing [Bot] and 14 guests