- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
一个含有synchronized修饰符方法的类
public class ForTest {
private int i = 0;
public synchronized void fun1(){
i = 100;
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("fun1: i = " + i);
}
public void fun2(){
i = i + 1;
System.out.println("fun2: i = " + i);
}
}
两个线程类
public class MyThread1 implements Runnable {
private ForTest ft = null;
public MyThread1(ForTest ft){
this.ft = ft;
}
public void run() {
ft.fun1();
}
责编:罗莉
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>