File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help on private access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Help on private access" Watch "Help on private access" New topic
Author

Help on private access

George Jin
Greenhorn

Joined: Oct 18, 2002
Posts: 4
class A
{
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?

Thanks
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Yes it is. Have you tried The Java Tutorial ?


SCJP2. Please Indent your code using UBB Code
praveena kuppachi
Greenhorn

Joined: Jan 24, 2003
Posts: 15
Hi
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: http://aspose.com/file-tools
 
subject: Help on private access
 
Similar Threads
private member
An ambiguous question from round up game
Problem with Coupling
Question from http://www.javaranch.com/game.html...
access private member