发新话题
打印

关于java里chars的

关于java里chars的

// The "InputChars" class.
// Shi Yi 18 Jun 2008
import java.awt.*;
import hsa.Console;
public class InputChars
{
    static Console c;           // The output console
   
    public static void main (String[] args)
    {
        c = new Console ();
        
        char ch1, ch2, ch3;
        c.println("Type in any three characters in the Kyeboard");
        c.println("Press <Enter> after ecah.");
        ch1 = c.readChar ();
        ch2 = c.readChar ();
        ch3 = c.readChar ();
        c.println();
        c.print("Together these 3 letters spell: ");
        c.println(ch1 + ch2 + ch3);
    } // main method
} // InputChars class





以上是全部,我反反复复对着教材上看过了,没有不同,可是按教材上说的这样运行应该可以让我输入三个字母,可是我自己试的时候却是每次都只能输两个字母,除非我三次都不输字母直接输回车,就会有三次,请问是为什么啊?帮我看看哪里不对好吗
还有,这个命令我依然没有弄明白是什么意思,看教材上说的应该是输入字母却会显示数字,但是那是按什么规律排的字母和数字我也没弄明白~~

TOP

发新话题