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?
About Question enthuware.ocajp.i.v7.2.855 :
Moderator: admin
-
- Posts: 32
- Joined: Sat May 02, 2015 11:57 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.855 :
1. Please use code tags so that the code is readable by others.
2. Why will what be converted to double?
2. Why will what be converted to double?
-
- Posts: 32
- Joined: Sat May 02, 2015 11:57 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.855 :
Code: Select all
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;
}
}
4.0
Why will it convert to double?
Who is online
Users browsing this forum: No registered users and 7 guests