有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (2) 个答案

  1. # 1 楼答案

    要使其工作,请再创建一个重载构造函数,该构造函数接受两个Fraction参数:

    public Fraction(Fraction f1, Fraction f2) {
        this(f1.a*f2.b, f1.b*f2.a); 
    }
    
  2. # 2 楼答案

    只有在编写2个重载构造函数时才有可能:

    public Fraction (int a1 , int b1)

    public Fraction (Fraction f1 , Fraction f2)