GETTER & SETTER METHODS

Getter and Setter methods are used to protect the data and make the code more secure. private variables can access within the same class. An outside class can’t access the private variable. Using get & set methods, we can access the other class private variables. Get method returns the variable value Set method sets theContinue reading “GETTER & SETTER METHODS”

ASSESSMENT – 1

Scenario #1:Expected Understanding: Access Modifiers, Single Inheritance, getter methods, Constructor Overloading 1) Create a Class named “Trainer”.– Have default instance variables String dept, institute– Have private instance variable int salary– Assign 10000 as value for salary.– Create getter method for salary.– Assign values – “Java”, “Payilagam” to them– Have instance method training() with void asContinue reading “ASSESSMENT – 1”

Design a site like this with WordPress.com
Get started