![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java语言程序设计 高级篇
summer_style
努力学习的小牛!
展开
-
线程的调度
线程的调度 线程的优先级等级 MAX_PRIORITY:10 MIN_PRIORITY:1 NORM_PRIORITY:5 线程优先级涉及的方法 getPriortiy():返回线程的优先级 setPriority(int newPriortiy):改变线程的优先级 线程创建时继承父线程的优先级 第优先级只是获得调度的概率低,并非一定是在高优先级线程之后才被调用。 package threadStudy; public class Main { public static void main(Str原创 2020-07-06 23:21:02 · 123 阅读 · 0 评论 -
Thread类中的常用方法
Thread类中的常用方法 1:start() 启动当前线程,调用当前线程的run()方法 2:run() 通常需要重写Thread类中的此方法,将创建的线程要执行的操作声明在此方法中 案例1: package threadStudy; public class Main { public static void main(String[] args) { MyThread mythread = new MyThread(); mythread.start(); for(int i = 0;原创 2020-07-06 22:59:19 · 1097 阅读 · 0 评论