GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes q 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 "q " Watch "q " New topic
Author

q

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
public void divide(int a, int b) {
try {
int c = a / b;
}
catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}

Prints out: Finally
Prints out: Exception
Prints out: Exception Finally
No output

i answered 1st option, but the correct option is 3.
The 3rd option wud be correct, if b = 0.
No such condition is mentioned here.

Wht shd be the correct answer and y?


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Joe Borderi
Ranch Hand

Joined: Oct 23, 2004
Posts: 151
Have you tried to compile and run the code? Use some test cases and test the output.
Jay Ashar
Ranch Hand

Joined: Oct 13, 2002
Posts: 208
I am not sure if there is any correct answer to your question, unless you supply a value of a and b variables.
[ November 22, 2004: Message edited by: Mike Saloni ]

SCJP 1.4<br />SCWCD 1.3
 
GeeCON Prague 2014
 
subject: q