How to interrupt an Infinite Loop

前端 未结 12 1840
自闭症患者
自闭症患者 2021-02-02 10:36

Though I know it\'ll be a bit silly to ask, still I want to inquire more about the technical perspective of it.

A simple example of an infinite loop:

pub         


        
12条回答
  •  清酒与你
    2021-02-02 10:45

    I feel dirty even writing this, but...

    From a different thread, you could call System.setOut() with a PrintStream implementation, which throws a RuntimeException when you call println().

提交回复
热议问题