Can someone tell me, why the debugger doesn't show variable j
in stack frame(Using IntelliJ IDEA)?
for (int i = 0 ; i < 10; i++) {
int j = 100;
}
when i = 0
, variable j
should be created once, then, being removed from the stack, then i = 2
, j should be loaded into the stack, but IntelliJ debug tool doesn't show the creation of j
once, Where is the problem? Thank you
Screenshot:
There is a tool, please try it out https://cscircles.cemc.uwaterloo.ca/java_visualize/#
This variable is not used and javac
compiler optimizes the bytecode by completely removing it. You can add some usage for the variable, like log it so System.out
and then you should be able to see it in the debugger.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.