I want to do something like below in java.
String subject=null,receiver=null,subject_db=null,receiver_db=null,cc=null,cc_db=null;
suject=msg.getSubject();
sub_db=rs.getString("subject");
receiver=msg.getreceiver();
receiver_db=rs.getString("receiver");
cc=msg.getcc();
cc_db=rs.getString("cc"); String foldername;
if((subject.equals(sub_db)) && (receiver.equals(receiver_db)) && (cc.equals(cc_db)))
foldername="spam";
else
foldername="Inbox";
As you can see here, any of the variables can be null. If this happens then it throws me NullPointerException. Is there any way I can do like,
String s1=null and String s2=null and if I compare if(s1.equals(s2)) then it returns me true... I know above code is not gonna work to achieve this. But how do I do that in some other way ?
I am really sorry if I have failed to explain my problem properly...
I would appreciate any help..
Thank you..