Article View: borland.public.jbuilder.java.api
Article #1603Is this a bug ???
From: Hanan Hermon
Date: Mon, 05 Nov 2001 08:58
Date: Mon, 05 Nov 2001 08:58
46 lines
1669 bytes
1669 bytes
Hi,
Below there are to small classes with a main method.
When I run it I expected the output to be "Init", but surprisingly it was
"Def".
I found out that when we set default values in the class descriptions it
is being set after we return from the ancestor constructor.
I expected that the default values will be set before the constructor
starts.
Is this a bug or that is the way it should work ?
I'm using JBuilder 4 on Windows-NT.
Here ate the classes descriptions:
abstract class Base
{
abstract public void init();
Base()
{
init();
}
}
public class Sub extends Base
{
private String mTemp = "Def";
public void init()
{
mTemp = "Init";
}
static public void main(String[] args)
{
Sub tmp = new Sub();
System.out.println(tmp.mTemp); // Expected output is "Init" ?!
}
}
Technical Details
Message-ID:
<3be65516_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,25fa17041a8095b7,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-11-05 01:09:03 PST From: "Hanan Hermon" <hananh@radcom.co.il> Newsgroups: borland.public.jbuilder.java.api Subject: Is this a bug ??? Date: Mon, 5 Nov 2001 10:58:38 +0200 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 192.116.176.125 Message-ID: <3be65516_2@dnews> X-Trace: dnews 1004950806 192.116.176.125 (5 Nov 2001 01:00:06 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews