• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is itgood example for exception  RSS feed

 
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say you want to build an application for police about surcharge.

When operator want to enter information, If he enters wrong information application must do a reaction.

For example, If he enters information about a car driver,and enter surcharge because driver did not use helmoot( that a person who rides motorcycle uses that), The application must throws an exception.

Is it good example for usage of exception?
 
Marshal
Posts: 5657
769
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. However, the thrown exception must be handled an provide a user-friendly error message.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!