Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        System.out.println("#1:" + Thread.interrupted());

        Thread mainThread = Thread.currentThread();
        mainThread.interrupt();

        System.out.println("#2:" + mainThread.isInterrupted());

        System.out.println("#3:" + mainThread.isInterrupted());

        System.out.println("#4:" + Thread.interrupted());

        System.out.println("#5:" + mainThread.isInterrupted());
    }
}