代码如下:
public class LocalVariablestTest {
private int count = 0;
public static void main(String[] args) {
LocalVariablestTest test = new LocalVariablestTest();
int num = 10;
for (int i = 0; i < 10; i++) {
int a=i;
}
}
}
使用idea直接打开编译后的class文件,发现 int num = true;
package com.lazydsr.study.test;
public class LocalVariablestTest {
private int count = 0;
public LocalVariablestTest() {
}
public static void main(String[] args) {
new LocalVariablestTest();
int num = true;
for(int i = 0; i < 10; ++i) {
}
}
}
这是为啥?实在搞不懂了,求助
没有C币,见谅