File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Make it so: Java DB Connections & Transactions
this week in the
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
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
I agree. Here's the link:
subject: Help on private access
access private member
Problem with Coupling
Question from http://www.javaranch.com/game.html...
An ambiguous question from round up game
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015