Given the definition of the Vehicle class:
Which action encapsulates the Vehicle class?
Given the definition of the Vehicle class:
Which action encapsulates the Vehicle class?
To encapsulate the Vehicle class, the name variable should be made private. This restricts direct access to the variable from outside the class, ensuring that it can only be accessed or modified through the public getName() and setName() methods. Encapsulation helps protect the integrity of the data by controlling how the data is accessed and modified.
D is the answer
C and D are correct. Since we should choose only 1 answer -> D
C and D should be correct.
I think C & D are correct if have to change with 2 actions
Answer is D.