请各位大侠帮帮忙! 输入两个字符,按回车就结束了,读入的是ASCII码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 char a,b; a=(char)System.in.read(); b=(char)System.in.read(); System.out.println("a="+a+","+"b="+b);楼主不管输入多少字符,只读取前两个按回车就结束了.如果想读入字符窜的话 public static String getString() {//use static make a class method to read // a // Sring from kedboard String input = ""; BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in)); try { input = stdin.readLine(); } catch (IOException iox) { System.err.println(iox); } return input; } 我是想就像C语言如:for(i=0;i<4;i++) scanf("%d",&a[i]);这样连续的输入值实在是不理解JAVA是如何做的 请哪位帮我看看这段小程序? 关于哈希冲撞的问题 jdbc连接mysql问题,请高手赐教 20分求解:这样强制类型转换怎么不行啊 ###书上的一个信息隐藏的例子,请各位高手进来关注一下!! 谢谢~~~~~ 估计你们一般答不出来的弱智问题 求助??setVisible与show有什么区别? 在线等待高手解答 怎样在文本文件中追加内容? 昨天我贴的问题怎么无缘无故没有了?气死我了。 对Applet 有没有好一点的,快速一点的掌握方法!不是急于求成,想请教一点经验!比较急切!在线等! 关于发展方向~
a=(char)System.in.read();
b=(char)System.in.read();
System.out.println("a="+a+","+"b="+b);
楼主不管输入多少字符,只读取前两个
按回车就结束了.如果想读入字符窜的话
public static String getString() {//use static make a class method to read
// a
// Sring from kedboard String input = "";
BufferedReader stdin = new BufferedReader(new InputStreamReader(
System.in)); try {
input = stdin.readLine();
} catch (IOException iox) {
System.err.println(iox);
}
return input;
}
scanf("%d",&a[i]);
这样连续的输入值实在是不理解JAVA是如何做的