filmov
tv
#41 Getters and Setters in Java
Показать описание
Check out our courses:
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we will learn:
Setters and getters in Java
- What are setters?
- What are getters?
-
Shortcut for writing getters and setters in Eclipse:-
- The name of a method should define the objective of the model.
- For every variable, we have two things: Setters and Getters methods inside a class in Java programming.
- Getter and Setter are methods used to protect your data and make your code more secure.
- Getter and Setter make the programmer convenient in setting and getting the value for a particular data type.
- In both getter and setter, the first letter of the variable should be capitalised.
Getters:-
- If you want to get the value of a method, we use getters.
= public int getAge();
Setters:-
- To set the value in a method, we use overloading.
= public void setAge()
- There is no complusion that there should be all methods and variables inside the class.
Shortcut for writing getters setters in Eclipse:-
= Right-click on the editor - source action or insert code - Generate getters and setters.
More Learning :
Donation:
PayPal Id : navinreddy20
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we will learn:
Setters and getters in Java
- What are setters?
- What are getters?
-
Shortcut for writing getters and setters in Eclipse:-
- The name of a method should define the objective of the model.
- For every variable, we have two things: Setters and Getters methods inside a class in Java programming.
- Getter and Setter are methods used to protect your data and make your code more secure.
- Getter and Setter make the programmer convenient in setting and getting the value for a particular data type.
- In both getter and setter, the first letter of the variable should be capitalised.
Getters:-
- If you want to get the value of a method, we use getters.
= public int getAge();
Setters:-
- To set the value in a method, we use overloading.
= public void setAge()
- There is no complusion that there should be all methods and variables inside the class.
Shortcut for writing getters setters in Eclipse:-
= Right-click on the editor - source action or insert code - Generate getters and setters.
More Learning :
Donation:
PayPal Id : navinreddy20
Комментарии