Opposite of Java .equals() method?
23:26 07 Jun 2013

I'm trying to write a little block of code in Java with a do-while loop that asks the user's name. If it isn't the name the code is looking for, then it just repeats itself. For example,

Scanner scan = new Scanner();
do { 
   System.out.println("whats your name?"); 
   String name = scan.nextLine(); 
} while ("jack".equals(name));  ////// <<<<

It's where I marked with <<<< that I don't know what to do. I need something like !=, but that does not work with strings.

So what can I put here?

java conditional-statements equals