Oracle
1Z0-808 · Question #10
Given: public class SumTest { public static void doSum(Integer x, Integer y) { System.out.println("Integer sum is " + (x + y)); } public static void doSum(double x, double y) { System.out.println("dou
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #10. The question stem and answer options stay visible for context.
Working with Methods and Encapsulation
Question
Given:
public class SumTest {
public static void doSum(Integer x, Integer y) {
System.out.println("Integer sum is " + (x + y));
}
public static void doSum(double x, double y) {
System.out.println("double sum is " + (x + y));
}
public static void doSum(float x, float y) {
System.out.println("float sum is " + (x + y));
}
public static void doSum(int x, int y) {
System.out.println("int sum is " + (x + y));
}
public static void main(String[] args) {
doSum(10, 20);
doSum(10.0, 20.0);
}
}
What is the result?
Options
- Aint sum is 30 float sum is 30.0
- Bint sum is 30 double sum is 30
- CInteger sum is 30 double sum is 30.0
- DInteger sum is 30 float sum is 30.0
Unlock 1Z0-808 to see the answer
You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#method overloading#type matching#primitive types#string concatenation