是否有一种方法可以在Java中发出断点信号,如C#中的System.Diagnostics.Debugger.Break()?
几天前,我看到for ( ; ; )了无限循环的结果.这让我对两件事感到好奇.
public static void main(String[] args) {
File dir = new File("dir");
dir.mkdir();
File file = new File(dir,"file.txt");;;;;
;
;
;
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
;
;
;
;
}
}
Run Code Online (Sandbox Code Playgroud)
编译器显示额外的分号没有错误.并且代码运行就好像没有发生任何错误.我想知道幕后发生了什么?包括这样的分号是否会消耗更多的堆栈内存,因此需要更多的处理器周期才能运行?