How to Use Getter and Setter methods in Java using NetBeansIDE

Published: 03 June 2013
on channel: raksrahul
4,448
6

How to use Getter and Setter functions of Data Transfer Object and Data Access Object.

1. Open NetBeansIDE

2. In a project make a class(DTO) file say 'FileDTO'

3. In FileDTO

3.1. Here I have declared two private String type variables 'name' and 'hobby'

3.2. Right click on source area in netbeans and goto

insert code..-Getter and Setter..

3.3. Choose required variables for which you want to generate Getter and Setter methods

3.4. Click Generate

4. Make another class(DAO) file say 'FileDAO'

4.1. In this file, make a 'static function' & write the code for connection and query (insert, delete, update, etc)

4.2. Get values of the variables of 'FileDTO' by making an object and calling 'getter'
function

5. Make a JFrame Form say 'NewForm'

5.1. Add JTextFields and a JButton

5.2. For JButton Action-actionPerformed event type the code for 'setting' values to the
DTO variables and make a call to the function of DAO

6. Run NewForm.java

7. Finish

#Java #LearnJava #NetBeansIDE


Watch video How to Use Getter and Setter methods in Java using NetBeansIDE online without registration, duration hours minute second in high quality. This video was added by user raksrahul 03 June 2013, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,448 once and liked it 6 people.