Re: when using equals method with a null string...



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

njzy333@xxxxxxxxx schreef:
Hello Tony,
That is strange. The difference between your code and my code is that I
declared both strings to be private, and neither are NEWed. I changed
my code according to your example, and I'm still getting an exception.
I guess there is a slight difference in our environment or libraries?
I'm using NetBeans with Java 1.5.

Learn the difference between null and "". "" will not throw an NPE if
you invoke methods on it. See http://mindprod.com/jgloss/string.html,
the part about comparison and gotchas.

H.
--
Hendrik Maryns

==================
www.lieverleven.be
http://aouw.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEEa86e+7xMGD3itQRAvD9AJoD/32bPrkTf7IL7+RzI1C/MRYSdwCfc4F9
JQEz0IvI5kQOKHpd98ZVayA=
=ow03
-----END PGP SIGNATURE-----
.



Relevant Pages