Click to See Complete Forum and Search --> : reurns null constantly


ajkiwi88
05-03-2007, 07:39 AM
bassically bellow is two sections of my code. the code is used to tell a user if a company has the car in stock to meet there needs.
now the top section is for model and works fine as do all the other text ones however the second section deals with floating numbers and returns the value null constantly. any ideas? cyaz andy

String model = searchSpec.model.toLowerCase();
if ((model != null) && (!model.equals("")) &&
(!model.equals(this.model.toLowerCase())))
{System.out.println("not model");return false;}


Float engineSize = searchSpec.engineSize;
if ((engineSize != null) && (!engineSize.equals("")) &&
(!engineSize.equals(this.engineSize)))

potterd64
05-03-2007, 08:01 PM
You'd have to look at where searchSpec.engineSize is set in order to see why it's null. Also is engineSize supposed to be a float or a Float? You have it as a Float, which is an object, but it may be easier to represent it as a float, which is a primitive type like an int.