A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
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
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
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