I know this should be a simple fix but I can't figure it out. This is my class that generates the factors for a given number. It works until I try to use the return, in which it says cannot find symbol: variable a, even though it has been declared. I bolded the line the error is on. Any help?
}[/CODE]
Code:
import java.util.Scanner;
public class FactorGenerator
{
public static int initialNumber;
public FactorGenerator()
{
for (int a=1; a < initialNumber; a++)
{
if(initialNumber%a == 0)
{
System.out.println(a + " ");
}
}
} public static int getFactors()
[B]{
return (a +"");
}[/B] [CODE]
Comment