package dev;
public class deviceThread implements Runnable{
private String name;
protected deviceThread(String name){
this.name=name;
}
@Override
public void run() {
try {
for (int i = 0; i < 10; i++) {
System.out.println(this.name+" "+i);
Thread.sleep(2000);
}
}catch (Exception e){
}
}
//多线程和return的测试
public static void main(String[] args) {
System.out.println(start());
}
public static int start(){
Thread device1 = new Thread(new deviceThread("设备1"));
Thread device2 = new Thread(new deviceThread("设备2"));
device1.start();
device2.start();
return 90;
}
}
前端请求,实现先return,后继续执行逻辑
最新推荐文章于 2023-07-22 01:16:36 发布