简体   繁体   中英

How do I read a char from a user in the command line

How do I read a char from a user in the command line. I am familiar with readInt(). Is there something like this for chars.

This is for the stanford course I am taking online as part of stanford engineering everywhere over the summer and I need to finish soon before my high school term starts.


Is there any way I can do this using the acm.util, acm.program acm.util, or java.awt class because that's all I'm allowed for the assignment.

final DataInputStream dis = new DataInputStream(System.in);
final char c = dis.readChar();

java.util.Scanner类几乎是为这个构建的:),但奇怪的是仍然存在隐藏的秘密,因为没有多少人知道它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM