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

0 votes
38 views
asked by Expert (15k points) 15 23 32

1 Answer

0 votes
You can use it to accept user keyboard input.

import java.io.IOException;

public class MainClass {

  public static void main(String[] args) {

    try {
      char c = (char) System.in.read();
      while (c != '\r') {
        System.out.println(c);
        c = (char) System.in.read();
      }
    } catch (IOException e) {
    }

  }

}
answered by Geek (15.3k points) 19 43 70

Related questions

0 votes
1 answer 46 views
46 views asked by augustaina Sr Member (4.8k points) 10 26 32
0 votes
1 answer 16 views
16 views asked by john Guru (27.1k points) 35 53 115
0 votes
2 answers 19 views
19 views asked by john Guru (27.1k points) 35 53 115
0 votes
1 answer 67 views
67 views asked by om Sr Member (1.3k points) 8 17 32
0 votes
1 answer 19 views
19 views asked by sunny Expert (11.4k points) 16 23 32
...