Value printed by a mixed overloaded expression

Consider the following Java program. The character 'A' has Unicode value 65.


Java
public class Scaler {
    static int scale(int x)       { return x * 2; }
    static long scale(long x)     { return x + 100; }
    static double scale(double x) { return x / 2; }

    public static void main(String[] args) {
        double r = scale(4) + scale(4L) + scale(9.0) + scale('A');
        System.out.println(r);
    }
}


What value does the program print? Give the number to one decimal place.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Method Overloading Questions: