问题标签 [throws]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 发生 SQLException 时如何调用自定义异常?
假设我有以下几行代码,
现在我想要的是,当捕获到 SQLException 时,我想从 SQLException 的 catch 字段中抛出我的自定义异常,我的意思是可以这样做还是有其他方法可以这样做?
我的自定义异常是 ErrorToDisplayException 为:
我的代码如下:
现在发生的情况是,当编译器到达 }catch(final SQLException se){ 时,它并没有进入它的 catch 主体,只是脱离了,不知道为什么?
java - 异常异常与 Server.main(String[]) 中的 throws 子句不兼容
我正在通过以下链接在 Eclipse Indigo 上运行唇读代码: https ://github.com/sagioto/LipReading/blob/master/lipreading-core/src/main/java/edu/lipreading/WebFeatureExtractor.java
在以下行中:
我收到以下错误:
请帮我解决这个问题。
java - 什么时候需要在 Java 中添加 throws?
在以下示例中,Eclipse 不会要求我添加“ throws EmptyStackException”
但是,在以下示例中,需要“抛出异常”
关于何时应该添加投掷是否有任何具体规则?
java - 这里使用了“throws”子句,如果不使用怎么办?
这是我的代码
在这里徘徊的是,在此代码的第 1 行中throws Exception
究竟做了什么?
即使我没有使用它,我也得到了相同的输出
输出:main 中捕获的异常
哪里会有效果?这段代码有必要吗?
java - 任何人都可以纠正我给定的陈述,如果它是错误的(关于投掷/投掷)
THROW
:-我们必须处理异常(我们在这里是用户)。
Throws
:我们要求编译器处理引发的异常。
如果我上面说的有误,请指正。如果错了,请告诉我正确的说法。
感谢进阶!
android - Android, SQLite exception error with wrong inputs
Sorry, noob in Android.
I have operations with SQLite database
, working fine with correct inputs.
Password
work fine alltimes, but when i put wrong username
. That means, insert
when username
is already exists or select
when username dont exist, my app will crash with java.lang.NullPointerException
and i really dont know why and where !
Here's a code:
DatabaseOp.java - class with operation on SQL DB // problem in fetchUser()
LoginActivity.java - Using Activity // problem in populateUser()
when i want log in with not exist account
RegisterActivity.java - Using Activity // problem in populateUser()
too when registering existing account
LogCat
java - 我的自定义异常是否正确编码?
我已经为 MonthsNumberException 编写了代码,这段代码写对了吗?我在异常方面遇到了很大的麻烦,我将如何为 MonthsNameException 创建异常,以便当用户键入不在列表中的月份时,将引发异常。
}
java - 调用另一个只抛出异常的方法时,“方法必须返回结果”
即使Assert.fail()
只抛出一个AssertionError
. 如果我抛出一个AssertionError
自己而不是调用Assert.fail()
它编译。
java - 抛出在 Java 中是如何工作的?
我一直在使用 catch,现在我必须使用 throw。这就是我得到的,我无法弄清楚缺少什么以便它可以工作。
file - 如何将 throws IOExcpetion 添加到此代码中?
这是我的主要课程:
这是巴拉方法:
现在我的问题来自我遵守它的时候。它告诉我在 init 方法中有一个未报告的 IOException,但是当我在该方法上添加 throws IOException 时它告诉我:
错误:Table 中的 init() 无法覆盖 Applet 中的 init()
我怎样才能解决这个问题和/或如何在不修改大部分内容的情况下解决这个问题?