📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      Consider the following Java code snippet  public

      class Car {     private String model;     private int year;     public Car(String model, int year) {         this.model = model;         this.year = year;     }     public String getModel() {         return model;     }     public void setModel(String model) {         this.model = model;     }     public int getYear() {         return year;     }     public void setYear(int year) {         if (year > 1900 && year
      A Inheritance Correct Answer Incorrect Answer
      B Polymorphism Correct Answer Incorrect Answer
      C Abstraction Correct Answer Incorrect Answer
      D Encapsulation Correct Answer Incorrect Answer

      Solution

      The correct answer is D

      Practice Next
      ask-question