Click here to Skip to main content
       

Java

 
AnswerRe: Annotation Pinmembermuthu shankar7-Jan-13 4:30 
AnswerRe: Annotation PinmemberApril Fans16-Jan-13 21:58 
QuestionCan some one port this java code to c#? PinmemberDanish Samil25-Dec-12 23:28 
AnswerRe: Can some one port this java code to c#? PinmemberTorstenH.27-Dec-12 23:56 
GeneralRe: Can some one port this java code to c#? PinmemberDanish Samil30-Dec-12 22:46 
Questionwhy I have to use Pinmemberdemo 225-Dec-12 17:47 
AnswerRe: why I have to use PinmvpRichard MacCutchan25-Dec-12 21:29 
AnswerRe: why I have to use PinmemberTorstenH.27-Dec-12 23:54 
You have to protect variables, because you depend in them.
 
Limiting the access to the getter and setter, you can depend on the variables to be used in the context you expect to have them.
Also, you can validate the value on the setter, which gives you the chance to to reject the value in case it is not ok (throw Exception). This protects your code from failing.
 
As a 3. argument: The same variable can be part of different methods/classes. but each name of a variable has to be unique, otherwise the code will fail.
So one limits down the range, where the variable exists as much as possible. therefor, one can use the same name again - not that one does it constantly, but one has the chance to.
 
And last but not least: it's simply good design/style to do so.
The usage of static should also be limited as much as possible.
There are some occasions where it is needed - but that should be used as less as possible.
 
Please read about the "encapsulation" - the link, that Richard posted. And please do some more research.
This is a basic of java development. One can't go without this, so you need to understand it.
regards Torsten
When I'm not working

GeneralRe: why I have to use Pinmemberdemo 21-Jan-13 17:53 
QuestionJava Netbeans Error Regarding Arraylist in BufferedWriter Method Pinmember100,00121-Dec-12 9:02 
AnswerRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmvpRichard MacCutchan21-Dec-12 23:03 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmemberTorstenH.22-Dec-12 1:23 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmvpRichard MacCutchan22-Dec-12 1:31 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmemberTorstenH.22-Dec-12 1:42 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmvpRichard MacCutchan22-Dec-12 1:53 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method [modified] Pinmember100,00122-Dec-12 13:12 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmvpRichard MacCutchan22-Dec-12 23:30 
AnswerRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method PinmemberTorstenH.22-Dec-12 1:19 
Questionjava Pingroupquest4knowledge21-Dec-12 6:46 
AnswerRe: java PinmvpRichard MacCutchan21-Dec-12 22:50 
AnswerRe: java PinmemberApril Fans22-Dec-12 21:15 
GeneralRe: java Pingroupquest4knowledge13-Jan-13 0:33 
Questionproblem in running derby database PinmemberMember 858607221-Dec-12 2:38 
AnswerRe: problem in running derby database PinmemberTorstenH.22-Dec-12 1:29 
Questionexecutive java program PinmemberOmarSH20-Dec-12 22:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 18 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid