In this code
public void display(int x, double y){
System.out.println("Double");
}
public void display(int x, float y){
System.out.println("Float");
}
public static void main(String[] args){
prog01 p = new prog01();
p.display(4,5); //First Output
p.display(4,5.0); // Second Output
}
The outputs are:
Float
Double
The second output is understandable, but why is 5 being cast to float when it should have given an error?