Reply to comment

try/catch in main

One of my favorite examples is the main method with try/catch.

For example:
http://www.roseindia.net/java/beginners/java-read-file-line-by-line.shtml

public static void main(String args[]) {
try{
FileInputStream fstream = ...
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}

This try/catch is absolutely NOT NEEDED! If you skip them, the JVM does absolutely the same work. :)

Reply

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.