java编程题,求y的值

求图中的题 急急急

public class Main {
    public static void main(String[] args) {
        int x = 1;
        double y = 0;
        if(x > 0){
            y = 2 * x;
        }else if(x == 0){
            y = 2 + Math.cos(x);
        }else{
            y = x * x + 1;
        }
    }
}

追问

恩恩  不过为什么运行没有显示东西啊= = 

温馨提示:答案为网友推荐,仅供参考