Click here to Skip to main content
15,888,802 members
Home / Discussions / Java
   

Java

 
AnswerRe: Annotation Pin
WebMaster2-Jan-13 22:14
WebMaster2-Jan-13 22:14 
AnswerRe: Annotation Pin
April Fans3-Jan-13 15:44
April Fans3-Jan-13 15:44 
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 
Hi guys I need some one who really worked in series project to explain some concept


my teacher making a big story about private variable.

people always says we used private to make java hide the containing
.

Java
 package Student;


public class Student {

public static void main(String[] args) {


    information x = new information();
     x.ID();




{

Java
package Student ;

 
public class information{

         private  int ID=0;
         private string name="";
           private  int GPA =0;

         }


I know I can't change ID without using set and get but this my question


if I will use set and get I can make my life easy just make ID like this

Java
public int ID=0;



instead using set and get method.


my teacher said to protect the information from user !!!!!!!!


I don't why he said that ?

because user will see message like enter number and then the code will do calculation

like :

Please enter two Numbers :

5

4

The result : 9


So I still I don't know why I should use private which force me to use set and get .




please guys help me and remember I know this stupid question but I ask because I know how to use private but I don't why ?


before I just write this question I read and watch online youtube but there nothing I get


I'm a person who has only small memory takes only logical things and throw illogical thing.
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 
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 

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.