🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

newbie question

#8753
From: sandelf
Date: Fri, 02 Mar 2001 08:33
17 lines
1260 bytes
I was studing how to use arrays,
and I found  these piece of code as a suggested solution of an exercise:
public class Bevere{
    public static void main(String argv[]){
	Bevere b = new Bevere();  // <-- here !
	b.Claines();
    }
    public void Claines(){
	String[] names= new String[]{"Peter","John","Balhar","Raj"};
	System.out.println(names[0]);
    }
}

How it is possible to create an instance of a class inside its method (i.e.
main)?
regards
Sa ndelf
Technical Details
Message-ID: <3a9f5ade$1_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!213.241.42.242

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3a5b2c9b663406b5,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-02 00:38:07 PST
From: "sandelf" <sandelf@poczta.onet.pl>
Newsgroups: borland.public.jbuilder.java.language
Subject: newbie question
Date: Fri, 2 Mar 2001 09:33:01 +0100
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 213.241.42.242
Message-ID: <3a9f5ade$1_2@dnews>
X-Trace: 2 Mar 2001 00:33:34 -0800, 213.241.42.242
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!hub.org!hub.org!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!213.241.42.242