A
anonaki
Why does the code below throw a java.lang.NullPointerException?? The
two objects being compared obviously don't become Null references.
any help would be greatly appreciated.
import java.util.*;
class test3
{
public static void main( String [] args )
{
Object obj1 = new Integer( 1 );
Object obj2 = new Integer( 2 );
if ( cmp.compare( obj1 ,obj2 ) == 0 )
System.out.println( "They are Equal" );
}
static Comparator cmp;
}
two objects being compared obviously don't become Null references.
any help would be greatly appreciated.
import java.util.*;
class test3
{
public static void main( String [] args )
{
Object obj1 = new Integer( 1 );
Object obj2 = new Integer( 2 );
if ( cmp.compare( obj1 ,obj2 ) == 0 )
System.out.println( "They are Equal" );
}
static Comparator cmp;
}