Home

Java Overloading Quiz 2

What is the output of the following code? (write "error" if the program does not compile or throws an exception)

public class Test{
  double m1(double d){
    return d * d;
  }

  int m1(int i){
    return m1(i * i);
  }

  float m1(float f){
    return m1(f + f);
  }

  public static void main(String[] args){
        Test t = new Test();
        System.out.println(t.m1(10));
  }
}
Your answer: