DEV Community

Discussion on: How to copy files in Java? Example

Collapse
codenameone profile image
Shai Almog

Well written.

One of the things I haven't seen enough in Java demos of this type is the usage of main throws. Instead of writing a try/catch for a simple hello world just write:

public static void main(String[] argv) throws IOException {
  // ...
}
Enter fullscreen mode Exit fullscreen mode

Reduces some of the noise in hello world style code and command line utilities.

Collapse
javinpaul profile image
javinpaul Author

Indeed, try-catch just obscure business logic. In real world application also, making the decision where to handle excpeption can be really tricky.