A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Help on private access
Joined: Oct 18, 2002
Jan 30, 2003 09:28:00
private int i;
public void modifyOther(A a1)
a1.i = 20; //1
Why a1 can access the private member i? Is it because this method within Class A?
Joined: Jul 03, 2001
Jan 30, 2003 10:08:00
Yes it is. Have you tried
The Java Tutorial ?
SCJP2. Please Indent your code using UBB Code
Joined: Jan 24, 2003
Jan 30, 2003 10:12:00
A method or a variable that is declared private i s not accesible outside the class.Thats is only the members belonging to the class can acces it.it can be used by the instance of the class that declares it
subject: Help on private access
Question from http://www.javaranch.com/game.html...
access private member
An ambiguous question from round up game
Problem with Coupling
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014