Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Apr 27, 2004
May 23, 2004 02:53:00
private int number = 2;
public static void main(
Test a = new Test(); //why instance can access private member?
but I don't understand that number in Test class is modified privete,why
the instance of Test main method can access number variable?
My Way,My Pace
Joined: Jul 10, 2001
May 23, 2004 06:02:00
That is because main is also inside the class.
all the private variables and methods canbe accessed inside the class any way we want it.
rocket mass heater
subject: private modifier
Hierarch of non-static inner class
private & static
Regarding access to private members.
What is the purpose of instantiating an object in another class?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013