Using 'this' in a Constructor
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;
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | bommasam000 | 3 | 3 | 0m 36s | 264 |
| #2 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #3 | y.seong2027 | 1 | 2 | 0m 38s | 52 |
Items per page:
10
1 – 3 of 3
