| Author |
veriables in Java Bean
|
Vilas Lawande
Ranch Hand
Joined: Nov 07, 2006
Posts: 127
|
|
Writing variables is like in Java Bean like
1. private String password;
2. private String password = null;
3. private String password = "";
Which will be better programming approach and why?
Please elaborate.
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
Well, it all depends on what you want your variables to be initialised to! There is no 'best answer' in this case, although I suspect a lot of people by default (and IDEs) would produce private String password; (which is effectively the same as private String password = null;).
|
Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
|
 |
Vilas Lawande
Ranch Hand
Joined: Nov 07, 2006
Posts: 127
|
|
|
Thank a lot.
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
You're welcome
|
 |
 |
|
|
subject: veriables in Java Bean
|
|
|