How to throw RuntimeException (“cannot find symbol”)

后端 未结 9 1069
别跟我提以往
别跟我提以往 2021-02-03 18:47

I\'m trying to throw an exception in my code like this:

throw RuntimeException(msg);

But when I build in NetBeans I get this error:

<         


        
9条回答
  •  时光说笑
    2021-02-03 19:16

    you will have to instantiate it before you throw it

    throw new RuntimeException(arg0) 
    

    PS: Intrestingly enough the Netbeans IDE should have already pointed out that compile time error

提交回复
热议问题