File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Exception Handing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Exception Handing

Ma JianHui

Joined: Mar 01, 2008
Posts: 6
public class Plane {
static String s = "-";

public static void main(String[] args) {
new Plane().s1();

void s1() {
}catch(Exception e) {
s +="c";

void s2()throws Exception {
s3(); s +="2";
s3(); s +="2b";

void s3() throws Exception {
throw new Exception();


The output is : "-c",what is going on?
Please help me!Thanks!
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

Please avoid posting the same query more than once as it wastes time.
I agree. Here's the link:
subject: Exception Handing
It's not a secret anymore!