Multithreaded debugging settings can be consulted: http://www.cnblogs.com/leodaxin/p/7710630.html
1 Breakpoint Settings
2 test the code and then debug
Packagecom.daxin;ImportJava.util.HashMap;/*** Created by Daxin on 2017/10/22.*/ Public classHashmapinfiniteloop {Private StaticHashmap<integer, integer> map =NewHashmap<integer, integer> (2, 0.75f); Public Static voidMain (string[] args)throwsinterruptedexception {map.put (5, 55); NewThread ("Thread1-name") { Public voidrun () {System.out.println ("Thread1-name Start"); Try{Thread.Sleep (5000); } Catch(interruptedexception e) {e.printstacktrace (); } map.put (7, 77);//Breakpoint Position 1System.out.println (map); }}.start (); NewThread ("Thread2-name") { Public voidrun () {Try{System.out.println ("Thread2-name Start"); Thread.Sleep (5000); } Catch(interruptedexception e) {e.printstacktrace (); } map.put (3, 33);//Breakpoint Position 2System.out.println (map); }}.start (); //Breakpoint Position 3System.out.println ("Thread-main-name Start"); System.out.println ("Thread-main-name Start"); System.out.println ("Thread-main-name Start"); Thread.Sleep (500000); }}
3: Start Debug, we can double-click the thread that needs to be debugged in the Threads tab option
Then select the debug thread in the Frames tab option for shortcut key debugging.
Idea Multi-threaded multiple threads switching breakpoints running debugging tips