About Question enthuware.ocajp.i.v7.2.855 :
Posted: Wed May 20, 2015 5:05 am
After changes,
public class P2{
public static void main(String[] args) throws Exception {
P2 t = new P2();
int i = t.getLoad();
double d = t.getLoad1();
System.out.println( i + d );
}
public int getLoad() {
return 1;
}
public double getLoad1(){
return 3.0;
}
}
Output:
4.0
Why will it convert to double?
public class P2{
public static void main(String[] args) throws Exception {
P2 t = new P2();
int i = t.getLoad();
double d = t.getLoad1();
System.out.println( i + d );
}
public int getLoad() {
return 1;
}
public double getLoad1(){
return 3.0;
}
}
Output:
4.0
Why will it convert to double?