Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 3: Class Creation
Start Practice TestPractice Test
About Exam
easy Solved by 3 students

Accessor Method Header

Mark
< Prev
Next >

Consider the following class definition.

public class Example
{
    private int x;
    // Constructor not shown.
}

Which of the following method headers, if added to the Example class, would allow other classes to access the value of the private instance variable x?

A

private int getX()

B

public void getX()

C

public void getX(int x)

D

public int getX()

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 - 100
#2y.seong202712 8m 33s -423
#3bommasam00044 37m 37s -1,857
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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