When I write following thing Java compiler out put errer.
======================
String s;
*************
if(s == null)
{
***********
}
=======================
and
======================
String s;
*************
if(s.compareTo(null) == 0)
{
***********
}
======================
But, actuary I have to do following thing.
======================
String s = null;
*************
if(s == null)
{
***********
}
=======================
======================
String s;
*************
if(s == null)
{
***********
}
=======================
and
======================
String s;
*************
if(s.compareTo(null) == 0)
{
***********
}
======================
But, actuary I have to do following thing.
======================
String s = null;
*************
if(s == null)
{
***********
}
=======================
Comments