Comparing two equal Short numbers results to uknown equality

Short s = 2007;

Short l = 2007;

if(s == l){

System.out.println("Equals");

}elseif(s < l){

System.out.println("s less");

}if(s > l){

System.out.println("s greater");

}else{

System.out.println("Status unknown");

}

When i test the above numbers, it result to the last if meaning they are neither equal, less than or greater than each other. How would i compare the above numbers s and l?

Please help......

[959 byte] By [kagaraa] at [2007-11-27 10:46:29]
# 1

You have two Short objects and not two short primitives. When comparing objects you should use the equals method.

floundera at 2007-7-28 20:19:12 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you for the reminder. I must have been overbuddened by coding

kagaraa at 2007-7-28 20:19:12 > top of Java-index,Java Essentials,Java Programming...