【发布时间】:2019-06-17 18:38:34
【问题描述】:
我正在尝试制作一个简单的计算程序,但每当我尝试运行代码时,我都会收到此错误。我怎样才能避免这种情况?
TextField inputOne = new TextField("Input first data");
// Making output 1
int inputNumber = Integer.parseInt(inputOne.getText());
总是收到错误消息 java.lang.reflect.InvocationTargetException 在第 25 行放置 parse int 的位置
【问题讨论】:
-
InvocationTargetExceptions 总是有一个原因(查看堆栈跟踪中的Caused by:s)。在您的情况下,它可能是NumberFormatException。 -
@BigBoi,您将增加获得响应的可能性,提供有关您的问题的更多上下文信息。看看这个帖子:How to create a Minimal, Reproducible Example