Java掌握台输入输出[Java编程]
本文“Java掌握台输入输出[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
* *
* * 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
*
* 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掌握台输入输出[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |