Matthew Brown wrote:I think your problem is here:
If getname() returns null, the first part of that expression will throw a NullPointerException. The test for null needs to come before calling any methods of the object.
(As an aside, shouldn't it be getName(), setName(), etc to follow the Java Beans convention?)
Matthew Brown wrote:I just did! The test for null needs to come first. E.g:
The only thing that kept the leeches off of me was this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|