[Bluej-discuss] Endles compilation without error report
Karl Heinz Bernhart
kh.bernhart at web.de
Fri Apr 21 11:47:37 BST 2006
Hello to all list members,
when I try to compile the elementary example class given below, the
compiler seems to hang and the process must be terminated violently
via resetting the JVM. (BlueJ 2.1.2 MacOS 10.4.5)
The class implements two methods for calculating the factorial of a
number - one iteration and one recursion.
Commenting out the one or the other method didn't help.
I cannot see the bug:
//======================================
public class Fakultaet
{
public long FIt(int n)
{
//iterative Berechnung der Fakultaet einer Zahl n
long factorial=1;
for (int i=1; i<=n; i++)
factorial *= i;
return factorial;
}
public long FRek(int n)
{
//rekursive Berechnung der Fakultaet einer Zahl n
if (n == 0)
return 1;
return n*FRek(n-1);
}
//========================================
Maybe someone has an idea?
Thanks
Karl Heinz
More information about the bluej-discuss
mailing list