Solved

Consider the Following Code Snippet

Question 31

Multiple Choice

Consider the following code snippet:
Public class Course
{
Private int studentCount;
) . .
}
Which of the following methods would correctly keep track of the total number of enrollees in a course?


A) public void addEnrollees(int newEnrollees)
{
StudentCount = newEnrollees
}
B) public void addEnrollees(int newEnrollees)
{
StudentCount = studentCount + newEnrollees
}
C) public void addEnrollees(int newEnrollees)
{
NewEnrollees = studentCount
}
D) public void addEnrollees(int newEnrollees)
{
NewEnrollees = newEnrollees + studentCount
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions