社区
Java SE
帖子详情
public String getA() throws Exception中的throws Exception表示什么意思?
qcrsoft
2003-08-30 06:21:38
俺是初学,一时查不到资料,烦劳兄弟们给指点一些多谢多谢!
...全文
174
5
打赏
收藏
public String getA() throws Exception中的throws Exception表示什么意思?
俺是初学,一时查不到资料,烦劳兄弟们给指点一些多谢多谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
star821116
2003-08-30
打赏
举报
回复
表示可能会抛出异常,这个可以在程序中用
try{
}
catch(Exception e){
}
来处理也可以简单的通过声明throws Exception如果有异常就抛出到异常链上
CD2
2003-08-30
打赏
举报
回复
public String getA() throws Exception{
...
try{
...
}catch(Exception e)
{
...
}
...
(...)代表程序代码
teaky2002
2003-08-30
打赏
举报
回复
就是说getA()中可能回有异常抛出,需要其他调用他的函数来处理。
cool_li
2003-08-30
打赏
举报
回复
提供标准异常库,捕捉异常产生!
wuyi1979
2003-08-30
打赏
举报
回复
当方法getA()执行产生异常时抛出异常,在调用此方法时,必须捕捉异常
java
exception
用法_Java
中
异常(
Exception
)的用法
package com.base.
exception
;
public
class Car {
String
name;
public
Car() {// TODO Auto-generated constructor stubthis.name = "";}
public
Car(
String
name) {// TODO Auto-generated constructor stubthis.name ...
JAVA-Apache-POI-java.lang.IllegalState
Exception
: Cannot get a
STRING
value from a NUMERIC cell
使用Apache-POI读取excel文件时,如果获取数据的方法与实际类型不符,会抛出IllegalState
Exception
错误,如下:
Exception
in thread "main" java.lang.IllegalState
Exception
: Cannot get a
STRING
value from a NUMERIC cell at org.apache.poi....
java google翻译api接口_java 免费调用google 谷歌翻译api
谷歌的翻译api是收费的,但是为了临时用一下,可以免费hack他们网页版的翻译接口,而且不需要验证。[1]java代码如下
public
class Translator {
public
String
translate(
String
langFrom,
String
langTo,
String
word)
throw
s
Exception
{
String
url = "https://transl...
【Java】Callable 接口
多线程
中
最常用的是Runnable接口,定义了一次任务执行的内容。但是Runnable接口无法得到返回值,而且也无法让执行端捕获到异常。所以就有了Callable接口。
public
interface Callable { /** * Computes a result, or
throw
s an
exception
if unable to do so. *
java捕获线程异常
在jdk1.5之前,线程不允许抛出异常(各个线程要把自己的checked
exception
处理掉),但是无法避免的是unchecked
exception
,也就是Runtime
Exception
,当抛出异常时子线程会结束,但不会影响主线程。主线程通过try catch是无法捕获子线程异常的,Thread对象提供了setUncaught
Exception
Handler(Thread.Unca
Java SE
62,614
社区成员
307,327
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章