I have a method which returns a string. It can be in normal operating conditions that a blank string or null is returned. However, is it a good coding practise to return null or "" from this method?
I have a method which returns a string. It can be in normal operating
Share
Yes, in that situations I prefer returning
nullto show that string is not found. Empty string has usually used for showing empty result.Alternative way is to throw some
Exception, but as programmer I don’t find usable to work with Exceptions. Returningnullis much better.