This site requires JavaScript, please enable it in your browser!
Greenfoot back
Hersov
Hersov wrote ...

2014/12/4

Catch statement?

Hersov Hersov

2014/12/4

#
Hey, Can anyone tell me what this line actually does because I've been using it for a while but dont actually know its purpose.
1
catch (Exception e){ e.printStackTrace(); }
davmac davmac

2014/12/4

#
A "catch" statement must follow a "try" block. It catches any exception (of the given type) that occurs during execution of the try block. In your example, it then prints the stack trace from the exception.
You need to login to post a reply.