这段代码中的变量 'x' 会存储在堆栈内存、堆内存或两者中吗?

would the variable 'x' in this piece of code be stores in stack memory, heap memory, or both?

所以关于变量int x。在这个class开头,int xString s存放在堆内存中。但是,当构造函数启动时,int x存储在堆栈内存AND堆内存中,因为构造函数在技术上是否是一个方法?

public class A {
    int x;
    public String s = "";

    public A(int y) {
        x = y;
    }
}

y 存储在堆栈中,因为它是该方法的作用域变量。 x 只是在堆上就地修改。