Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have two variable and both are strings and I need to compare both variable if it match it should return true otherwise false.
As we know equals function (var1.equals(var2)) does not handle null values and it thows "null pointer exception ".In other words , both variables should have values only then it can work .If I used two equals function (==) function It is not giving expected result as we know the reason.
I am looking for that solution where I can compare null String with a value
var1="2016-01-03 11:05:07"
var2=null