Java的字符比较出现了问题,请问是怎么回事?

源代码

import java.util.Scanner;

public class Move {

    public static void main(String[] args) {

        int x = 0;
        int y = 0;
        Scanner input = new Scanner(System.in);
        String name = "Hello World!";
        while (true) {
            String id = input.nextLine();
            if (id == "w" && y > 0) {
                y -= 1;
            }
            else if (id == "a" && x > 0) {
                x -= 1;
            }
            else if (id == "s") {
                y += 1;
                System.out.println(y);
            }
            else if (id == "d") {
                x += 1;
            }
            //System.out.println(x);
            //System.out.println(y);
            for (int i = 0; i < y; i++) {
                System.out.println("\n");
            }
            for (int i = 0; i < x; i++) {
                System.out.println(" ");
            }
            System.out.println(name);
        }
    }
}

上面的变量x和y一直都没有增加

请使用标准的写法(equals),我的编译器直接有警告

            if (id.equals("w") && y > 0) {
                y -= 1;
            }
            else if (id.equals("a") && x > 0) {
                x -= 1;
            }
            else if (id.equals("s")) {
                y += 1;
                System.out.println(y);
            }
            else if (id.equals("d")) {
                x += 1;
            }
            //S

ps:对象不同,内容相同,"=="返回false,equals返回true

C++ 应该是能用你的写法