菜鸟问题:如何读入数据? 读入字符串:BufferReader read = new BufferReader(new InputStreamReader(System.in));同样你要加上try{}catch{} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 然后,用read.readLine()得到字符串String str;while((str = read.readLine())!=null){System.out.println(str);}最后记得要关闭流。read.close() import java.io.*;class Test{ public static void main(String args[]) { try{ int a = System.in.read(); int b = System.in.read(); System.out.println(Mult(a,b)); } catch(IOException e) {} } public static int Mult(int M,int N) { int R; if(N ==1) R = M; else R = M + Mult(M,N-1); return R; }}请问这段程序哪里出问题了?为什么总得不到正确的结果,是不是输入语句有问题,还是函数调用的问题? java中获取时间的问题 多态问题 请问:uinx下如何获得网络文本流 swt:如何获取window的屏幕大小? 新手求救,关于如何学Java 谁有MODEM Class1传真命令集 如何用程序来模拟这样的猜数字游戏?多谢 为何编译通过没有被强制检查异常 序列化(serialization)时出错!!!! xp下jdk的完整安装? 编写一个应用程序,要求有一个窗口,两个依赖于它的对话框。。用于求圆和三角形面积。。(大家看看是哪错了啊) 虚心请教简单问题:java.lang.NullPointerException是如何产生的?应该如何解决?谢谢!
String str;
while((str = read.readLine())!=null){
System.out.println(str);
}
最后记得要关闭流。
read.close()
{
public static void main(String args[])
{
try{
int a = System.in.read();
int b = System.in.read();
System.out.println(Mult(a,b));
}
catch(IOException e)
{}
}
public static int Mult(int M,int N)
{
int R;
if(N ==1)
R = M;
else
R = M + Mult(M,N-1);
return R;
}
}
请问这段程序哪里出问题了?为什么总得不到正确的结果,是不是输入语句有问题,还是函数调用的问题?