Article View: borland.public.jbuilder.java.language
Article #7573Re: Another Java Puzzlet
From: John McGrath [TeamB]
Date: Fri, 08 Jun 2001 19:22
Date: Fri, 08 Jun 2001 19:22
17 lines
1511 bytes
1511 bytes
"Mark Griffiths" <DONT.SPAM.mark@chive.com> wrote:
> How about the following? The class 't' does not have a static main(), but
> before the JVM can find that out, it must load the class. When a class is
> loaded, it's static initializers are executed... bingo!
Exactly! You will get the message:
Exception in thread "main" java.lang.NoSuchMethodError: main
written to standard error, but otherwise, the program runs just as if you
had put the code in a main() method, rather than in a static initializer.
--
Regards,
John McGrath [TeamB]
Technical Details
Message-ID:
<3b212607_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!news2.euro.net!newsfeed.freenet.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!dnewsReferences:
<MPG.158a2ccca5eb796e98a27f@forums.borland.com> <3b20d156$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,aad772bb962488c X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-08 12:31:29 PST From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language References: <MPG.158a2ccca5eb796e98a27f@forums.borland.com> <3b20d156$1_1@dnews> Subject: Re: Another Java Puzzlet Date: Fri, 8 Jun 2001 15:22:50 -0400 Lines: 19 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 209.92.21.169 Message-ID: <3b212607_2@dnews> X-Trace: dnews 992028167 209.92.21.169 (8 Jun 2001 12:22:47 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!news2.euro.net!newsfeed.freenet.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!dnews