| preferred AP College board partner for AP classes
easy Solved by 5 students
Valid Java Constructor Calls
< Prev
Next >

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

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1y.seong202723 2m 22s 48
#2songqiuhui201201 0m 04s -14
#36test6ing602 0m 00s -20
#4suhanakochhar00613 18m 05s -1,005
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy