search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
4.2k views
asked Expert 11.4k points 14 22 28

1 Answer

0 votes
This class is introduce in java 1.6 version. This class is used to read the contents from the keyboard. Console is a available in “io” package.

We can not object of console class directly. It can be created by using console method available in System class.

import java.io.*;

class Read1{

public static void main(String[] args) throws IOException{

Console c = System.console();

String name = c.readLine(“Enter your name:”);

System.out.println(name);

Char[] pwd = c.readPassword(“Enter your password”);

System.out.println(pwd);

            }

}
answered Expert 15k points 15 23 30

Related questions

0 votes
1 answer 101 views
1 vote
1 answer 4.3K views
4.3K views
asked augustaina Sr Member 4.8k points 10 25 31
0 votes
1 answer 33 views
33 views
asked rock Expert 15k points 15 23 30
0 votes
1 answer 34 views
34 views
i am new to the java, while practice i have got lot of confusion to where i have to use the abstract class and where i have to use the interface.
asked john Guru 27.1k points 31 50 97
0 votes
1 answer 932 views
932 views
asked augustaina Sr Member 4.8k points 10 25 31
...