做..而java代码不能正常工作

时间:2017-05-07 21:06:27

标签: java eclipse do-while

**喂 我开始学习java了, 我写了这段代码&当我写admin时它会继续循环!

。 。 **

import java.util.Scanner;

public class Don1 {

    public static void main(String[] args) {

        String in_user, in_pass;

        do {

            Scanner user = new Scanner(System.in);
            System.out.println(" Please Login :\n Username :");
            in_user = user.nextLine();

            /*
             * Scanner pass = new Scanner(System.in); System.out.println(
             * " Please Login :\n Password :"); in_pass = pass.nextLine();
             */
        }

        while (in_user != "admin");

        System.out.println("1- Student Operation\n 2- Staff Operations \n 3- Admin Operations");
        System.out.println(in_user);
    }

}

,这是控制台流程:

 Please Login :
 Username :
w
 Please Login :
 Username :
admin
 Please Login :
 Username :

不知道错误在哪里:(

0 个答案:

没有答案