Question 6 / 297:  What is the expected output?
public class Profile {

private Profile(int w) { // line 1

System.out.println(w);

}

public static Profile() { // line 5

System.out.println(10);

}

public static void main(String args[]) {

Profile obj = new Profile(50);

}

}

A  Won't compile because of line (1) – constructor can't be private
B  10 50
C  50
D  Won't compile because of line (5) – constructor can't be static
<< First < Previous Next > Last >>
Explanation:

Only public, protected, private and default (no access modifier) are legal when declaring constructors.

Exam Home Page
Ask
Joanna Smithback
Start Quiz
David Bourgeois
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>