Re: when using equals method with a null string...
- From: Hendrik Maryns <hendrik_maryns@xxxxxxxxxxxxx>
- Date: Fri, 10 Mar 2006 17:54:18 +0100
-----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-----
.
- Follow-Ups:
- Re: when using equals method with a null string...
- From: Boobay
- Re: when using equals method with a null string...
- References:
- when using equals method with a null string...
- From: minjie
- Re: when using equals method with a null string...
- From: Tony Burrows
- Re: when using equals method with a null string...
- From: njzy333
- when using equals method with a null string...
- Prev by Date: Re: Compiler telling me I have 1.4 JDK when i have 1.5 wont compile generics code
- Next by Date: Re: redistribution of jdbc driver?
- Previous by thread: Re: when using equals method with a null string...
- Next by thread: Re: when using equals method with a null string...
- Index(es):
Relevant Pages
|