0
What happens if you overload a method without having an alternate?
eg public void do () { system.out.println ("A"); } public void do (int X) { system.out.println (X); } but when u call the method you use another type, like a double? Double dbl =3.655 do (dbl) excuse syntax errors.
2 Answers
+ 1
This program won't compile properly. The Java Virtual Machine (JVM) checks to determine if method caller parameters match the called method's parameters. In your example, you want do( double parameter) to call do( integer parameter) method. JVM will provide an error concerning improper parameter types.
+ 1
As it010101 wrote, you need to add new overloaded method
public void do (double X) {
system.out.println (X);
}