/* * 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);
}
}