| preferred AP College board partner for AP classes
AP Computer Science A/Unit 5: Writing Classes
Start Practice TestPractice Test
About Exam
easy Solved by 11 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

II only

B

I and II only

C

I only

D

I and III only

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1chunxiangxu.cxu11 0m 10s 90
#2y.seong202723 2m 22s 48
#3songqiuhui201201 0m 04s -14
#46test6ing602 0m 00s -20
#5suhanakochhar00613 18m 05s -1,005
#6bommasam00044 5h 54m -20,857
Items per page:
10
1 – 6 of 6
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy