Java 找不到符号

Java 找不到符号,java,class,variables,symbols,Java,Class,Variables,Symbols,我得到一个简单输出语句的编译错误: System.out.println(j); 但如果没有它,它就可以编译得很好 其次,每次(条件)的为真时,它都会迭代,但它怎么会是4/2(J不会迭代到3) 希望这是有道理的 public class FindFac { public static void main(String args[]) { for(int i = 2; i <= 50; i++) { System.out.print("Factors

我得到一个简单输出语句的编译错误:

 System.out.println(j);
但如果没有它,它就可以编译得很好

其次,每次(条件)的
为真时,它都会迭代,但它怎么会是4/2(J不会迭代到3)

希望这是有道理的

  public class FindFac {
    public static void main(String args[]) {

    for(int i = 2; i <= 50; i++) {
        System.out.print("Factors of " + i + ": ");
        for(int j = 2; j < i; j++)
            ***System.out.println(j);***
        if((i%j) == 0) System.out.print(j + " ");
        System.out.println();
    }
 }
}
公共类FindFac{
公共静态void main(字符串参数[]){

for(int i=2;i这是一个非常愚蠢的错误,您错过了for循环的开始和结束括号:

public static void main(String args[]) {

        for (int i = 2; i <= 50; i++) {
            System.out.print("Factors of " + i + ": ");
            for (int j = 2; j < i; j++) {
                System.out.println(j);
                if ((i % j) == 0) System.out.print(j + " ");
            }
            System.out.println();
        }
    }
}
publicstaticvoidmain(字符串参数[]){
对于(int i=2;i