Java tutorial
public class Main { public static void main(String args[]) { new ThreadClass("A"); Thread t = Thread.currentThread(); try { t.checkAccess(); System.out.println("You have permission to modify"); } catch (Exception e) { System.out.println(e); } } } class ThreadClass implements Runnable { Thread t; String str; ThreadClass(String str) { this.str = str; t = new Thread(this); // this will call run() function t.start(); } public void run() { System.out.println("This is run() function"); } }