牛客中的错题
package com.nps.base.xue.DataStructure.list; /* * @author XueWeiWei * @date 2019/9/8 16:51 */ public class JosephUS { static { int x = 5; } static int x,y; public static void main(String[] args) { x--; myMethod(); System.out.println("y:" + y); System.out.println("x:" + x); System.out.println(x+y+++x); } public static void myMethod() { System.out.println(x); y = x++ + ++x; System.out.println(x); System.out.println("myMethod中y的值:" + y); } }
-1 1 myMethod中y的值:0 y:0 x:1 2