About Question enthuware.ocajp.i.v7.2.855 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
subhamsdalmia
Posts: 32
Joined: Sat May 02, 2015 11:57 pm
Contact:

About Question enthuware.ocajp.i.v7.2.855 :

Post by subhamsdalmia »

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?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.855 :

Post by admin »

1. Please use code tags so that the code is readable by others.
2. Why will what be converted to double?

subhamsdalmia
Posts: 32
Joined: Sat May 02, 2015 11:57 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.855 :

Post by subhamsdalmia »

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;
}

}
Output:
4.0


Why will it convert to double?

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests