Home » Java programming language

Java System class inheritedChannel() method with example

System class inheritedChannel() method: Here, we are going to learn about the inheritedChannel() method of System class with its syntax and example.
Submitted by Preeti Jain, on September 14, 2019

System class inheritedChannel() method

  • inheritedChannel() method is available in java.lang package.
  • inheritedChannel() method is used to return the channel inherited from the entity that generated current JVM (Java Virtual Machine).
  • inheritedChannel() method is a static method so this method is accessible with the class name too.
  • inheritedChannel() method may throw a various exception and the description of the exception is given below:
    • IOException: In this exception, the exception will be thrown related to input/output error.
    • SecurityException: In this exception, it does not allow access to the Channel when security manager exists.

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.

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






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.