Click here to Skip to main content
15,889,116 members
Home / Discussions / Java
   

Java

 
AnswerRe: Annotation Pin
muthu shankar7-Jan-13 4:30
muthu shankar7-Jan-13 4:30 
AnswerRe: Annotation Pin
April Fans16-Jan-13 21:58
April Fans16-Jan-13 21:58 
QuestionCan some one port this java code to c#? Pin
Danish Samil25-Dec-12 23:28
Danish Samil25-Dec-12 23:28 
AnswerRe: Can some one port this java code to c#? Pin
TorstenH.27-Dec-12 23:56
TorstenH.27-Dec-12 23:56 
GeneralRe: Can some one port this java code to c#? Pin
Danish Samil30-Dec-12 22:46
Danish Samil30-Dec-12 22:46 
Questionwhy I have to use Pin
demo 225-Dec-12 17:47
demo 225-Dec-12 17:47 
AnswerRe: why I have to use Pin
Richard MacCutchan25-Dec-12 21:29
mveRichard MacCutchan25-Dec-12 21:29 
AnswerRe: why I have to use Pin
TorstenH.27-Dec-12 23:54
TorstenH.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 Pin
demo 21-Jan-13 17:53
demo 21-Jan-13 17:53 
QuestionJava Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
100,00121-Dec-12 9:02
100,00121-Dec-12 9:02 
AnswerRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
Richard MacCutchan21-Dec-12 23:03
mveRichard MacCutchan21-Dec-12 23:03 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
TorstenH.22-Dec-12 1:23
TorstenH.22-Dec-12 1:23 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
Richard MacCutchan22-Dec-12 1:31
mveRichard MacCutchan22-Dec-12 1:31 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
TorstenH.22-Dec-12 1:42
TorstenH.22-Dec-12 1:42 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
Richard MacCutchan22-Dec-12 1:53
mveRichard MacCutchan22-Dec-12 1:53 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
100,00122-Dec-12 13:12
100,00122-Dec-12 13:12 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
Richard MacCutchan22-Dec-12 23:30
mveRichard MacCutchan22-Dec-12 23:30 
AnswerRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
TorstenH.22-Dec-12 1:19
TorstenH.22-Dec-12 1:19 
Questionjava Pin
quest4knowledge21-Dec-12 6:46
quest4knowledge21-Dec-12 6:46 
AnswerRe: java Pin
Richard MacCutchan21-Dec-12 22:50
mveRichard MacCutchan21-Dec-12 22:50 
AnswerRe: java Pin
April Fans22-Dec-12 21:15
April Fans22-Dec-12 21:15 
GeneralRe: java Pin
quest4knowledge13-Jan-13 0:33
quest4knowledge13-Jan-13 0:33 
Questionproblem in running derby database Pin
Member 858607221-Dec-12 2:38
Member 858607221-Dec-12 2:38 
AnswerRe: problem in running derby database Pin
TorstenH.22-Dec-12 1:29
TorstenH.22-Dec-12 1:29 
Questionexecutive java program Pin
OmarSH20-Dec-12 22:41
OmarSH20-Dec-12 22:41 

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

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