java main函数为非守护线程(实时线程)

一直认为main为守护线程,google线程相关的资料时,发现有人说main函数是实时线程,特举例证明此结论!

 

	public static void main(String[] args) throws InterruptedException {
	    Thread t = Thread.currentThread();
	    System.out.println("Thread name:"+t.getName());
	    System.out.println("Thread.isDaemon="+t.isDaemon());;
	}

 

运行结果:

Thread name:main

Thread.isDaemon=false

 

 

你可能感兴趣的:(Java编程)