java system类
系统类InheritedChannel()方法 (System class inheritedChannel() method)
inheritedChannel() method is available in java.lang package.
java.lang包中提供了InheritedChannel ()方法 。
inheritedChannel() method is used to return the channel inherited from the entity that generated current JVM (Java Virtual Machine).
InheritedChannel()方法用于返回从生成当前JVM(Java虚拟机)的实体继承的通道。
inheritedChannel() method is a static method so this method is accessible with the class name too.
InheritedChannel()方法是静态方法,因此也可以使用类名访问此方法。
inheritedChannel() method may throw a various exception and the description of the exception is given below:
InheritedChannel()方法可能会引发各种异常,并且该异常的说明如下:
- IOException: In this exception, the exception will be thrown related to input/output error.IOException:在此异常中,将引发与输入/输出错误相关的异常。
- SecurityException: In this exception, it does not allow access to the Channel when security manager exists.SecurityException:在这种例外情况下,当安全管理器存在时,它不允许访问Channel。
Syntax:
句法:
public static Channel inheritedChannel() throws IOException{
}
Parameter(s):
参数:
It does not accept anything.
它不接受任何东西。
Return value:
返回值:
The return type of this method is Channel, it returns the inherited channel if channel is inherited, else it returns the null.
此方法的返回类型为Channel ,如果channel是继承的,则返回继承的通道,否则返回null。
Example:
例:
// Java program to demonstrate the example of
// inheritedChannel () method of System Class
public class InheritedChannelMethod {
public static void main(String[] args) {
try {
System.out.println("Inherited Channel: " + System.inheritedChannel());
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
Output
输出量
E:\Programs>javac InheritedChannelMethod.java
E:\Programs>java InheritedChannelMethod
Inherited Channel: null
翻译自: https://www.includehelp.com/java/system-class-inheritedchannel-method-with-example.aspx
java system类