Java System console() Method

The console() method of Java System class returns Console object only if any Console objected is associated with the java virtual machine.

Syntax

Returns

  1. The Console object of current java virtual machine.
  2. Null if Console object is not associated with current java virtual machine.

Example 1

Output:

Console is not supported

Example 2

Output:

Console is null