Hey, I'm currently writing a SUVAT calculator in Java, my program needs to know when the user enters a dash as an argument, my problem is essentially this code fragment:
if(args[x] != "-")
{
valuesYouHave[x] = true;
values[x] = Double.parseDouble(args[x]);
}
From my own testing I have deduced that the conditions on the if statement evaluate to true even if the argument is a dash, this obviously doesn't play nice with parseDouble and errors ensue. I can't see the problem with my if statement, but I haven't coded in a while over summer so I've inevitably missed something. Can anyone please help me?
Thanks,
Lolecule