Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 中断异常_Java_Multithreading_Interrupted Exception - Fatal编程技术网

Java 中断异常

Java 中断异常,java,multithreading,interrupted-exception,Java,Multithreading,Interrupted Exception,我在读关于InterruptedException的书,因为我在处理线程,我想知道catch(InterruptedException e)是一个特例,因为那里有一个e 我看过ie,但不幸的是,我似乎找不到任何网页来告诉我中断异常后的字母做了什么 是否存在不同的InterruptedExceptions 不,他们不是。InterruptedException之后的e或ie只是捕获引发异常的变量的名称 这段代码: try { } catch (InterruptedException e) {

我在读关于
InterruptedException
的书,因为我在处理线程,我想知道
catch(InterruptedException e)
是一个特例,因为那里有一个
e

我看过
ie
,但不幸的是,我似乎找不到任何网页来告诉我
中断异常后的字母做了什么


是否存在不同的
InterruptedException
s

不,他们不是。
InterruptedException
之后的
e
ie
只是捕获引发异常的变量的名称

这段代码:

try {
} catch (InterruptedException e) {
    e.printStackTrace();
}


基本上是一样的。唯一的区别是变量的名称,前者声明它为
e
,而后者声明它为
ie
不,它们不是。
InterruptedException
之后的
e
ie
只是捕获引发异常的变量的名称

这段代码:

try {
} catch (InterruptedException e) {
    e.printStackTrace();
}


基本上是一样的。唯一的区别是变量的名称,前者声明它为
e
,而后者声明它为
ie

它是无关的。它只是一个变量名。您可以将异常命名为任何名称

catch(Exception someVariableNameYouChoose)

这无关紧要。它只是一个变量名。您可以将异常命名为任何名称

catch(Exception someVariableNameYouChoose)

这只是异常对象的名称。你可以用“Kokoobanas”代替“e”:。只需确保您使用了
kokoobananers.printStackTrace()

,这只是异常对象的名称。你可以用“Kokoobanas”代替“e”:。只要确保使用
kokoobananers.printStackTrace()