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!

How to check return NULL with String

807605Aug 1 2007 — edited Aug 1 2007
Hi,
I am running a method, which returns a String value, and its function body is something like this:
public String methodName(int, int)
{
try{
  String data = check for string at location(int, int);
// "check" returns the value at particular location that i am storing in "data" variable
if(data ==NULL)
    return (String)(" ");
else 
    return data;
}catch
{
   //  print(error message);
// whatever
}
So, my problem is at line if(data==NULL)

i am not sure about, how to check the string with null value...
Right now i am getting the error message from Catch due to some exception in the try body.
If you got any idea about this matter then your help would be appreciated.

Thanks,
Ashish
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2007
Added on Aug 1 2007
6 comments
277 views