hi,

i receive an error on this line -- if (salesPersonsName <! "end") --

error : operator ! cannot be applied to java.lang.String

what can i do?

thanks

you can't negate a String, only a boolean.
I've no clue what you're trying to accomplish there so can't help you out.

Are you trying to say "not less than", if so why don't you just say "greater than"?

>
// instead of
<!

Edit: Nevermind, I'm an idiot, they're Strings so greater than and less than are not what you want anyway. Doh!

if you want to compare strings use compareTo() method ex: oneString.compareTo(anotherString). if oneString is greater then anotherString the method will return value >0, it it is less --> value <0, and if they are equal -->value =0.

I hope that this will help you.

Cao

I knid of doubt that will help though, as the majority of peoples names (as the variable implies that that that is) will not be alphabetically less than end. What the OP probably wants is if (!salesPersonsName.equals("end")) . And this thread is bit old, anyway. I doubt the OP is still looking for a solution.

I knid of doubt that will help though, as the majority of peoples names (as the variable implies that that that is) will not be alphabetically less than end. What the OP probably wants is if (!salesPersonsName.equals("end")) . And this thread is bit old, anyway. I doubt the OP is still looking for a solution.

I guess I'm missing something here. Unusual for you to reply an old thread. Did somebody posted something? Did any moderator moved anything?

Someone must have moved something, or something, as this popped up in my mail as if it had been replied to, and now that I look at the post above mine, I realise that that post is old too, I had just assumed it was just posted. ;-) Ah well, sheet happens.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.