aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question to test you Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question to test you" Watch "question to test you" New topic
Author

question to test you

Venkat Raman
Greenhorn

Joined: Mar 04, 2000
Posts: 22
I was just trying questions when this one occurred to me.
Pl tell the output of the program


[This message has been edited by maha anna (edited April 01, 2000).]
Venkat Raman
Greenhorn

Joined: Mar 04, 2000
Posts: 22
Sorry it's posted twice.
This is the real one
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Don't you think the code should be modified in order to print any value of i?

The spelling of "AritmeticException" should be "Arithmetic Exception".
The return statement should appear after finally clause in order to compile the program.
In this case the output of the program shall be
"exception /by zero", "Its all over..i'm quitting" and 6. The program continues the execution of the main method after the execution of the try/catch/finally statement.
I hope your question was intended to produce the above output. The program wont compile in its original version.

[This message has been edited by maha anna (edited April 01, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can also put "return z" inside the finally block instead of outside the finally block. In case of methods that return a value all the paths of execution should either return a value or throw an exception in order for it to compile. This program shall also compile if the method throws a new exception in the end.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question to test you