How can I enable this "Debugging in Runtime" Notch is talking about in this video in Eclipse?
As a test, I'd like to be able to edit the output of the following code and change it to "Hello Runtime Debugging" while it's running.
public class HelloWorld {
public static void main(String[] args) throws InterruptedException {
doIt();
}
private static void doIt() throws InterruptedException {
for (int i = 0; i < 1000; ++i) {
System.out.println("Hello World " + i);
Thread.currentThread().sleep(100);
}
}
}
EDIT: I modified the code, now I get the results I was looking for. Suraj Chandran's answer below explains it.
private static void doIt() throws InterruptedException {
for (int i = 0; i < 1000; ++i) {
print(i);
Thread.currentThread().sleep(100);
}
}
private static void print(int i) {
System.out.println("Hello Sir " + i);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…