集册 Java实例教程 使用InputStream从控制台读取字符

使用InputStream从控制台读取字符

欢马劈雪     最近更新时间:2020-01-02 10:19:05

573
使用InputStream从控制台读取字符
/* 来自 nowjava*/

import java.io.IOException;

 

public class Main {

 

        public static void main(String[] args) {

                 int iChar = 0;

                 

                 System.out.println("Read user input character example");

                 try

                 {

                        System.out.println("Enter a character to continue");

                        iChar = System.in.read();

                        System.out.println("Char entered was : " + (char)iChar);

                 }//来 自 n  o  w  j  a  v  a . c o m

                 catch(
展开阅读全文