I am passing an accountid as input from an XML file as shown, which will be parsed later and will be used in our code:
<accountid>123456</accountid>
<user>pavan</user>
The issue is that if nothing is passed (null value in accoutnid) is passed as accountid, I could not able to handle that situation in Java code. I tried this but I was not successful:
if (acct != null||acct==""||acct.equals(""))
{
// the above is not working
}
I was able to handle this successfully using the following approach:
if(!acct.isEmpty())
{
// thisis working
}
Can we rely on the String.isEmpty() method for checking the null condition of a String? Is this valid?