Valid Java Constructor Calls
Consider the following Student class declaration.
public class Student
{
private String myName;
private int myAge;
public Student()
{ /* implementation not shown */ }
public Student(String name, int age)
{ /* implementation not shown */ }
// No other constructors
}
Which of the following variable declarations will compile without error?
I. Student a = new Student();
II. Student b = new Student("Juan", 15);
III. Student c = new Student("Juan", "15");
A
I only
B
I and III only
C
I and II only
D
II only
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | y.seong2027 | 2 | 3 | 2m 22s | 48 |
| #2 | songqiuhui2012 | 0 | 1 | 0m 04s | -14 |
| #3 | 6test6ing6 | 0 | 2 | 0m 00s | -20 |
| #4 | suhanakochhar006 | 1 | 3 | 18m 05s | -1,005 |
APFIVE