Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 try 语句中编写了一些代码,在调试期间,代码运行良好。但是在 try 语句之后,控制转移到 catch 语句并且它抛出空指针异常。这是代码: -
仅当 try 大括号中的语句确实抛出异常时,才会执行 catch 大括号中的语句。
在这里,我认为你的testvar 是空的,这就是你有空指针的原因。
test