Click here to Skip to main content
12,298,406 members (52,535 online)
   

Java

 
QuestionCan some one port this java code to c#? Pin
Danish Samil25-Dec-12 23:28
memberDanish Samil25-Dec-12 23:28 
AnswerRe: Can some one port this java code to c#? Pin
TorstenH.27-Dec-12 23:56
memberTorstenH.27-Dec-12 23:56 
GeneralRe: Can some one port this java code to c#? Pin
Danish Samil30-Dec-12 22:46
memberDanish Samil30-Dec-12 22:46 
Questionwhy I have to use Pin
demo 225-Dec-12 17:47
memberdemo 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
.

 package Student;
 

public class Student {
 
public static void main(String[] args) {
 

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

 

{
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

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
mvpRichard MacCutchan25-Dec-12 21:29 
AnswerRe: why I have to use Pin
TorstenH.27-Dec-12 23:54
memberTorstenH.27-Dec-12 23:54 
GeneralRe: why I have to use Pin
demo 21-Jan-13 17:53
memberdemo 21-Jan-13 17:53 
QuestionJava Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
100,00121-Dec-12 9:02
member100,00121-Dec-12 9:02 
AnswerRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
Richard MacCutchan21-Dec-12 23:03
mvpRichard MacCutchan21-Dec-12 23:03 
GeneralRe: Java Netbeans Error Regarding Arraylist in BufferedWriter Method Pin
TorstenH.22-Dec-12 1:23
memberTorstenH.22-Dec-12 1:23 

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.


Advertise | Privacy | Mobile
Web01 | 2.8.160525.2 | Last Updated 28 May 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid