Developer community
0 votes
4.2k views
asked by Expert (11.4k points) 14 22 29 | 4.2k views

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 by Expert (15k points) 15 23 29

Related questions

0 votes
1 answer
asked by john Guru (27.1k points) 31 48 96 | 93 views
+1 vote
1 answer
asked by augustaina Sr Member (4.8k points) 10 23 31 | 4.3k views
0 votes
1 answer
asked by rock Expert (15k points) 15 23 29 | 31 views
0 votes
1 answer
asked by john Guru (27.1k points) 31 48 96 | 32 views
0 votes
1 answer
asked by augustaina Sr Member (4.8k points) 10 23 31 | 932 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


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

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users