多线程(2)
来源:互联网 发布:手机选号软件 编辑:程序博客网 时间:2024/05/08 23:46
练习:创建两个线程,和主线程交替运行
package exercise;class Thread1 extends Thread{ public void run(){ for (int i = 0; i < 20; i++) { System.out.println("thread1_____"+i); } }}class Thread2 extends Thread{ public void run(){ for(int i = 0;i<20;i++){ System.out.println("thread2___"+i); } }}public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Thread1 thread1 = new Thread1(); Thread2 thread2 = new Thread2(); thread1.start(); thread2.start(); for(int i = 0;i<20;i++){ System.out.println("main___"+i); } }}
阅读全文
0 0
- 多线程2
- 多线程2
- 多线程 - 2
- 多线程2
- 多线程2
- 多线程2
- 多线程-2
- 多线程2
- 多线程2
- 多线程2
- 多线程2
- 多线程2
- 多线程2
- 多线程-2
- 多线程2
- 多线程2
- 多线程(2):
- 多线程2
- input type=number 去掉输入框中的上下箭头
- 自我介绍
- solr home目录结构
- ATOM 编辑器使用心得
- HDU 1421 搬寝室
- 多线程(2)
- 车型数据重要性-汽车保养售后配件匹配数据库(机油 变速箱 滤清器 雨刷 大灯 刹车片)
- 设计模式_8:外观模式
- 第二章 运算符 if switch
- kvm — linux virtual server深入解识
- UVAlive 3126(最小路径覆盖)
- 5G时代的“轻终端、重云端”
- json相关
- Mat数据类型 convertTo