package
com.jasonhuang.test;
/**/ /*
* 测试从标准输入获得字符并从标准输出打印
*/
public class TestReadConsole ... {
/** *//**
* 读多少字符,返回多少。(最多30个字节)
*
* @param args
*/
public static void main(String args[]) ...{
try ...{
// 一次性读取最多30个字节的字符
byte b[] = new byte[30];
int length = System.in.read(b);
String s = new String(b, 0, length);
System.out.println(s);
} catch (Exception e) ...{
e.printStackTrace();
}
}
}
/**/ /*
* 测试从标准输入获得字符并从标准输出打印
*/
public class TestReadConsole ... {
/** *//**
* 读多少字符,返回多少。(最多30个字节)
*
* @param args
*/
public static void main(String args[]) ...{
try ...{
// 一次性读取最多30个字节的字符
byte b[] = new byte[30];
int length = System.in.read(b);
String s = new String(b, 0, length);
System.out.println(s);
} catch (Exception e) ...{
e.printStackTrace();
}
}
}