先看一下测试代码
public class Test001 {
public static void main(String[] args) {
Thread thread = new Thread(() -> {
method1(20);
});
thread.setName("t1");
thread.start();
method1(2);
}
public static int method1(int x){
System.out.println("方法1:"+x);
String cc = method2("cc");
return x;
}
public static String method2(String x){
System.out.println("方法2"+x);
return "method2"+x;
}
}
分别在主线程和t1线程 打上断点 重点来了 ,那么该如何打断点了?
右键点击断点 选择Thread 那么线程的端点就打好了
那么看一下效果吧
控制台就可以切换选择不同线程的断点辣