Question: I'll really ppreciate your help. Encapsulation in java is used to prevent direct access to instance variables from other classes, to achieve encapsulation we need

I'll really ppreciate your help.
Encapsulation in java is used to prevent direct access to instance variables from other classes, to achieve encapsulation we need to, first declare instance variables as private, second generate public getters and setters methods, and third set and get the values of these instance variables. Create two classes of your choice to demonstrate the concept of encapsulation in java as follows: Class A will have at least 3 instance variables with private access modifiers. Generate public getters and setters for these variables. Class B will set and get these variables by implementing setters and getters. Class names may vary per student. Click Here or Here to watch YouTube video about encapsulation in java. Inheritance Inheritance in java is used to simplify programs and eliminate redundant code, common properties between classes usually belong to the parent class while more specific properties belong to child classes, we use the keyword extends to implement inheritance where child class can access the methods and variables of its parent class. Create two classes of your choice to demonstrate the concept of inheritance as follows: Class A is the Parent class, it has at least one method and one variable. Class B extends Class A and inherits all its variables and methods. Class names may vary per student. Click Here or Here to watch YouTube video about inheritance in java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
