online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
public class Main { public static void main(String[] args) throws InterruptedException { TestThread myThread = new TestThread("myThread "); myThread.start(); System.out.println( "Start Tread " + myThread); for( int j = 0; j<5;j++){ System.out.println( "myThread "+ j); try{ Thread.sleep (2); }catch(Exception f ){ } } // myThread.join(); try{ System.out.println( myThread.isInterrupted()); //isInterrupted() до прерывания myThread.interrupt(); System.out.println( myThread.isInterrupted()); //isInterrupted() после прерывания }catch(Exception f ){ } System.out.println( "Прерывание"); Thread.sleep (500); System.out.println( myThread.isInterrupted() + " isInterrupted() 0.5 сек" ); //isInterrupted() 0.5 сек после прерывания System.out.println( "Finish Main"); } public static class TestThread extends Thread{ int count= 0; TestThread(String name){ super(name); } public void run(){ while(!isInterrupted()){ try{ this.sleep(1); }catch(InterruptedException e ){ break; } System.out.println(" --"+ this.getName()+ " "+ this.isInterrupted() + count++); } } } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue