Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Android Tip – How to define Getter/Setter methods

DZone's Guide to

Android Tip – How to define Getter/Setter methods

· Java Zone ·
Free Resource

Secure your Java app or API service quickly and easily with Okta's user authentication and authorization libraries. Developer accounts are free forever. Try Okta Instead.

Hello All,
This is a tip to define Getter/Setter methods in an easy way; Object initialization.

I'm sharing this tip because I have seen many people defining Getter/Setter methods on their own and after understanding my tip, you will consider what you did before a time wasting task :)

Now, lets come back to the point and follow the below steps to define Getter/Setter methods for a particular class.

Step 1: Open Eclipse and Create one Android project

Step 2: Create a class and declare attributes that you want for this class.

Step 3: Select these 3 attributes inside the class and right click -> source -> Generate Getters and Setters…

You are done. Enjoy programming and shortcuts :)

 

 

Secure your Java app or API service quickly and easily with Okta's user authentication and authorization libraries. Developer accounts are free forever. Try Okta Instead.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}