花之慶次 2008-8-17 17:12
這個Java程式又出了什麼問題
import java.io.*;
class Sample5_09
{
public static void main(String args[])throws IOException
{
System.out.println("請問要在第幾次終止回圈呢??(1~10) ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
int res=Integer.parseInt(str);
[color=red] for(int i=1; int<=10; i++)
[/color] {
System.out.println("第" +i+ " 次的處理 ");
if(i==res)
break;
}
}
}
紅字部份就是出錯地方, 因為不能構成.class
fredng 2008-8-17 21:20
[quote]原帖由 [i]花之慶次[/i] 於 2008-8-17 17:12 發表 [url=http://forum.timway.com/f/redirect.php?goto=findpost&pid=5123394&ptid=211303][img]http://forum.timway.com/f/images/common/back.gif[/img][/url]
import java.io.*;
class Sample5_09
{
public static void main(String args[])throws IOException
{
System.out.println("請問要在第幾次終止回圈呢??(1~10) ");
BufferedReader br ...
[color=#ff0000]for(int i=1; int<=10; i++)[/color]
[/quote]
not int "for (int i=1; i[color=orange]nt[/color]<=10; i++)"
should be for "(int i=1; [color=darkorange]i<=10[/color]; i++)"
花之慶次 2008-8-17 22:17
[quote]原帖由 [i]fredng[/i] 於 2008-8-17 21:20 發表 [url=http://forum.timway.com/f/redirect.php?goto=findpost&pid=5124377&ptid=211303][img]http://forum.timway.com/f/images/common/back.gif[/img][/url]
not int "for (int i=1; int [/quote]
好, 完全明白, 多謝你