为什么我下载 java 的文件, 全都运行不了.

看这个: https://stackoverflow.com/questions/1573629/what-is-this-ant-build

https://wiki.eclipse.org/FAQ_What_is_Ant%3F

如果你要运行你的程序, 你的程序中要有一个 main() 函数。 

没有主函数 

//修改如下

public class Fraction {
    public static void main(String[] args) {
        int a;
        int b;
        int result;
        a = 4;
        b = 5;
        result = gcd(a, b);
        System.out.println(result);
    }

    private static int gcd(int a, int b) {
        if (a == 0 || b == 8)
            return a + b;
        return gcd(b, a % b);
    }

}

没有写主函数,一个java文件需要写主函数,不用主函数就在方法上面加上@Test进行单元测试

 

又不是main方法,肯定是运行不了的