M
Mike
Hi:
public class bbb
{
public static void main(String args[])
{
System.out.println(sum(100000));
}
public static int sum(int n)
{
if(n==0)
break;
else
return sum(n-1)+n;
}
}
After I compiled the above program, error message shows " break
outside switch or loop".
Why?
Thank you in advance.
Mike
public class bbb
{
public static void main(String args[])
{
System.out.println(sum(100000));
}
public static int sum(int n)
{
if(n==0)
break;
else
return sum(n-1)+n;
}
}
After I compiled the above program, error message shows " break
outside switch or loop".
Why?
Thank you in advance.
Mike