Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java - how to check if a string is null

802079Sep 30 2010 — edited Sep 30 2010
//initialize someString
String someString = new String("");

//some code here with that may reset the string someString

//now I need to check if someString is empty
//do I use:
if (someString == null)

//or
Object nullValue = null;
if ((someString.equals(nullValue))

//or
if (someString == "")

//if I need to check if the someString is not empty
//can I use
if(someString != null)



please advise !!!

thx.

Comments

526209
Ok, so I've poked around a bit more and have found more info on DB_DBT_APPMALLOC:

http://www.sleepycat.com/docs/api_cxx/db_associate.html

"""
If the callback function needs to allocate memory for the data field rather than simply pointing into the primary key or datum, the flags field of the returned Dbt should be set to DB_DBT_APPMALLOC, which indicates that Berkeley DB should free the memory when it is done with it.
"""

This seems to answer my earlier questions. Thanks for your patience :)
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 28 2010
Added on Sep 30 2010
21 comments
12,261 views