System.console() in Java

System.console(): This method is available in java.lang.System class of Java.

Syntax:

Console java.lang.System.console()

Returns the unique Console object associated with the current Java virtual machine, if any.

Parameters: NA

Returns: The system console, if any, is otherwise null.

Exceptions: NA

Approach

Java

public class Systemconsole {
    public static void main(String[] args) {

        System.out.println(System.console());
    }
}

Output:

null

No comments:

Post a Comment