🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8634

Re: newbie question

#8634
From: Dave Bird
Date: Sun, 04 Mar 2001 20:11
26 lines
2120 bytes
In article <3aa29a70_1@dnews>, sandelf <sandelf@poczta.onet.pl> writes
>> I am not sure what you are asking. Why should it *not* be
>> possible to create an instance of a class inside main or any
>> other method for that matter?
>
>I mean recursive instantiation of a class inside its definition.
>How it is achieved, why there is no infinitive chain of creation?

 OK, this is difficult to explain.  

 In C++ you can specify that instances of a class literally
 contain the storage of an array, or another class object.  
 If you said that   class C1  contains the actual storage
 of another  class C1, then you would be in trouble; but
 it could contain a pointer to another class C1.

 In Java if a variable holds a class or array object then
 it actually holds a REFERENCE (effectively a pointer) to
 that object.  So   class c1   can perfectly well contain
 a variable which is a    c1 ,  because it will be a reference 
 to that object rather than literally its storage.  HTH.


-- 
   ^-^-^-@@-^-;-^   http://www.xemu.demon.co.uk/
        (..)__u     news:alt.smoking.mooses
Technical Details
Message-ID: <yNyOGVBJGqo6Ew3A@xemu.demon.co.uk>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!europa.netcrusader.net!194.159.255.21!dispose.news.demon.net!news.demon.co.uk!demon!xemu.demon.co.uk!dave
References: <3a9f5ade$1_2@dnews> <3a9f6830_2@dnews> <3aa29a70_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3a5b2c9b663406b5
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-04 14:16:11 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!europa.netcrusader.net!194.159.255.21!dispose.news.demon.net!news.demon.co.uk!demon!xemu.demon.co.uk!dave
From: Dave Bird <dave@xemu.demon.co.uk>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: newbie question
Date: Sun, 4 Mar 2001 20:11:53 +0000
Organization: none
Message-ID: <yNyOGVBJGqo6Ew3A@xemu.demon.co.uk>
References: <3a9f5ade$1_2@dnews> <3a9f6830_2@dnews> <3aa29a70_1@dnews>
NNTP-Posting-Host: xemu.demon.co.uk
X-NNTP-Posting-Host: xemu.demon.co.uk:158.152.196.209
X-Trace: news.demon.co.uk 983743878 nnrp-14:26994 NO-IDENT xemu.demon.co.uk:158.152.196.209
X-Complaints-To: abuse@demon.net
MIME-Version: 1.0
X-Newsreader: Turnpike Integrated Version 5.00 U <dQumtnY$x4rJ2u5tL5fS$n2vuP>
Lines: 26