Java控制台输入,输出!
2005-04-05 00:26
495 查看
/* * Created on 2005-4-5 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * @author Zhangql * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class EnterConsole { public static void main(String[] args) throws IOException { EnterConsole enterConsole = new EnterConsole(); enterConsole.printConsoleChar(); } /** * 从控制对接收一行字符串,然后输出到控制台 * @throws IOException */ public void printConsoleLine() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = null; System.out.println("Enter your value:"); str = br.readLine(); System.out.println("your value is :"+str); } /** * 从控制台接收一个字符 * 然后打印到控制台上 * @throws IOException */ public void printConsoleChar() throws IOException { System.out.print("Enter a Char:"); char i = (char) System.in.read(); System.out.println("your char is :"+i); } } |
相关文章推荐
- java控制台输入cmd命令, ssh远程linux shell命令, 并打印命令输出到控制台
- Java的三种简单的控制台输入和输出方式
- Java笔记5:解决MyEclipse控制台输入中文乱码输出问题(Eclipse也可以用)
- 用Java 编一段代码,实现在控制台输入一组数字后,排序后在控制台输出
- Java Console I/O Java控制台输入与输出
- 从控制台输入项目路径输出java到本地txt
- JAVA控制台输入输出方法总结
- java中从控制台输入数据和输出数据到控制台
- JAVA控制台输入输出方法总结
- Java简单输入&通过控制台输入相关指令,输出System类, RunTime类相关方法返回信息
- java—IO流——读取键盘输入的字母并转换成大写字母输出在控制台上
- Java笔记5:解决MyEclipse控制台输入中文乱码输出问题(Eclipse也可以用)
- Java控制台输入数组并逆序输出的方法实例[原创]_java_脚本之家
- java控制台的输入输出
- 插入排序(Java实现)---从控制台输入不定长数组,并输出排序结果
- 快速排序(Java语言实现)——从控制台输入数据,排序后输出
- java HelloWord(控制台输入和输出)
- java学习笔记#从控制台输入整数,输出最大最小值,直到输入0结束
- java改变控制台输入与输出
- java基础之IO流中实现对键盘和控制台的输入和输出以及写到文本文件