Are you taking CLEP classes? Try clep.ai
| 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 3 students

Using 'this' in a Constructor

Mark
< Prev
Next >

Consider the following class definition.

public class Calculator {
    private int total;

    public Calculator(int total) {
        // [Missing Line]
    }
}

Which statement, if placed at [Missing Line], correctly assigns the value of the parameter total to the instance variable total?

A

total = this.total;

B

this.total == total;

C

Calculator.total = total;

D

this.total = total;

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
#1bommasam00033 0m 36s 264
#2kaisuki11 0m 00s 100
#3y.seong202712 0m 38s 52
Items per page:
10
1 – 3 of 3

AI Tutor

How can I help?

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