Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/varargs-calls
Question 259 / 297:  What will be the output of this code?
class Basic_VarArg

{

public static void main(String... arg)

{

call(new String[]{"9","1"});

call(new Integer[]{6,1});

call(new int[]{5,1});

call(new Object[]{2,1});

}

static void call(Object ... ob)

{

System.out.println("Object ... "+ob[0]);

}

}

A  program compiles and run successfully without warnings.
B  program compiles and run successfully with warnings.
C  call(new int[]{5,1}); will result in warning.
D  compile error
Sorry No Instant Evalutaion available for this question
<< First < Previous Next > Last >>
Explanation:

warning is caused because of both the

call(new String[]{"9","1"}); and call(new Integer[]{6,1});

are non-varg calls.

Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Saylor Foundation
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>