Java
线程分类
java 中的线程分为两种类型:用户线程和守护线程。通过Thread.setDaemon(true)设置成守护线程,如果不设置这个属性,默认就是用户线程。
用户线程和守护线程的区别:
1.主线程结束后用户线程还会继续运行,JVM 存活;
2.如果没有用户线程,只有守护线程在运行,那么 JVM 运行结束
Static variable in Java is variable which belongs to the class and initialized only once at the start of the execution.
