This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Is it dvisable to throw exceptions inside the setter mehods ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is it dvisable to throw exceptions inside the setter mehods ?" Watch "Is it dvisable to throw exceptions inside the setter mehods ?" New topic
Author

Is it dvisable to throw exceptions inside the setter mehods ?

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Is it dvisable to throw exceptions inside the setter mehods ?

For example :



Thanks in advance.


Save India From Corruption - Anna Hazare.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38100
    
  22
Yes. Good idea.

But you should be circumspect about what sort of Exception you are throwing. I would enhance what you have written toNote that much of what I wrote is actually documentation comments, so users of that method know about the Exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it dvisable to throw exceptions inside the setter mehods ?
 
Similar Threads
Type inference in generic mehods
clarification about InetAddress class and its mehods
Question on Synchronized mehods
null as arg in mehods