小编Hif*_*ech的帖子

可抛出参数 'ex' 到 'System.out.println()' 调用

我目前正在研究一个库存管理系统。在系统中有注册选项,如下所示:

注册页面

以下代码显示了注册按钮方法:

        btnRegister.setOnAction(e ->{// register button method
            try {
            Stage stage = new Stage();
            FXMLLoader loader = new FXMLLoader();
            Pane root =         loader.load(getClass().getResource("Register.fxml").openStream());
            RegisterController Msg = loader.getController();
            Scene scene = new Scene(root);
            scene.getStylesheets().setAll(
                getClass().getResource("style.css").toExternalForm()
            );
            stage.setScene(scene);
            stage.show();
            ((Node) e.getSource()).getScene().getWindow().hide();

            } catch (Exception ex) {
                System.out.println(ex);
            }
        });
Run Code Online (Sandbox Code Playgroud)

我收到以下警告:

Warning:(64, 36) Throwable argument 'ex' to 'System.out.println()' call
Run Code Online (Sandbox Code Playgroud)

有人可以解释这个警告以及解决这个问题的可能方法吗?

如果被忽略,这会对以后的新更改产生任何影响吗?

它专门抱怨 register 方法中的以下代码行,其中异常是:

} catch (Exception ex) {
     System.out.println(ex);
}
Run Code Online (Sandbox Code Playgroud)

java javafx intellij-idea throwable

4
推荐指数
2
解决办法
1475
查看次数

标签 统计

intellij-idea ×1

java ×1

javafx ×1

throwable ×1