File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes System.out.println is Wrong?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "System.out.println is Wrong??" Watch "System.out.println is Wrong??" New topic

System.out.println is Wrong??

Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 80

Hi friends!

What is a best pratice in my catch blocks? (for dont lost poits)

1) catch (IOException e) {

2) catch (IOException e) {

3) catch (IOException e) {
logger.log(ERROR, ....)

4) they don't care

Many thanks

Julio Cesar Lopes Marques
Sun Certified Java Developer 5, Sun Certified Java Programmer 5
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2271

Fala ai Julio!!

In my opinion, it really depends on where you are. For instance, if you are in the business/services layer and an exception from a lower layer occurred there, you can log this exception and rethrow an exception that belongs to the business/services layer, with the lower level exception encapsulated in it. If you are in the last layer (for instance, the view layer), then you can log it and call JOptionPane.showMessageDialog, with JOptionPane.ERROR_MESSAGE.

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 80

Grande Bob!!

So it's sounds good to me but to be honest i'm with a little lazy to do like this and i had hope you say "yeah put system.out in everyplaces and go on!" lol. But.... if i can do, i can do...

Best Regards!!
I agree. Here's the link:
subject: System.out.println is Wrong??
It's not a secret anymore!