Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Catch Exceptions With Appropriate Ways  RSS feed

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, every professionals

During the course of my programming,I just saw many reference books.
I found different ways to handle exceptions in assignment or other programs.

For instance,I write a simple method to close the data file.


I also write a method to make user seen the message dialog.


Please comment on this problem. Which one is more suitable to SCJD assignment? (Because of involved GUI representation...)

Regards, Richard
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me, these options are pretty much the same. In both options, you tell the user that an error occured but gives no option to him.
I really think nothing could go wrong in:

public void closeFile(){
....
}

but if something happens to go wrong, I think you should give the user the option to get to a safe point.

Itapaj�.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!