Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3694

Re: a very tricky questio

From "Lew" <lew@THRWHITE.remove-dii-this>
Subject Re: a very tricky questio
Message-ID <5M6dnZkXwdZeP8LVnZ2dnUVZ_uadnZ2d@comcast.com> (permalink)
Newsgroups comp.lang.java.gui
References <b76ddfb5-f084-4adc-adf0-7e40ed824b66@q27g2000prf.googlegroups.co
Date 2011-04-27 15:46 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
birensubudhi@gmail.com wrote:
> In java [sic] in object only the nonstatic members are present & the static
> members donot reside in the object but we are accessing static members
> using object reference technique.

The static member still has to reside somewhere.  It isn't in limbo.  Static 
members reside in the class itself.  The class is like an object itself - it 
has member references and member methods, those marked 'static' in the class 
definition.

> since the static member do not reside in the object 

There is no "the object".  Static members reside in another object, the one 
representing the class itself.

> then how we are accessing it using object reference...

Two different things, objects and references.

Objects referred to by instance members don't "reside in the object" either. 
A reference lives inside an object, either in an instance object or the class 
itself.  The reference points to another object or to 'null'.  The referenced 
object doesn't "reside in" anything but heap, conceptually.

Classes and instances don't have member objects.  They have member references. 
  References point to objects.  Objects don't "reside in" other objects. 
References do, sometimes, but not necessarily in instance objects.  The place 
from which a reference points and the place to which it points are two 
different things.

-- 
Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread


Thread

Re: a very tricky questio "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:46 +0000

csiph-web