Multiple choice technology programming languages

Given: 20. public class CreditCard { 21. 22. private String cardlD; 23. private Integer limit; 24. public String ownerName; 25. 26. public void setCardlnformation(String cardlD, 27. String ownerName, 28. Integer limit) { 29. this.cardlD = cardlD; 30. this.ownerName = ownerName; 31. this.limit = limit; 32. } 33. }

  1. The class is fully encapsulated.

  2. The code demonstrates polymorphism.

  3. The ownerName variable breaks encapsulation

  4. The cardlD and limit variables break polymorphism.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Encapsulation requires hiding variables using the private modifier and exposing them via public methods. Declaring ownerName as public exposes it directly, breaking encapsulation.