🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2229

Re: How Static method is created by compiler?

#2229
From: Joi Ellis [TeamB]
Date: Sat, 28 Apr 2001 17:38
31 lines
1798 bytes
Frajola <fra_jo_la@ig.com.br> wrote:
> Friends,

> I think that a static method can be call
> without to criate the instance of the
> class.

> Why?

> Because the compiler identify if the
> class have a static method and create
> that instance of this class?

The JVM creates an object of class "Class" to represent every
class loaded by the JVM.  This instance of Class holds the 
bytecodes for the class itself.  

So, when you use a static method of a class, you're using
the bytecodes stored on the Class object the JVM when it loaded the
class.

This is why you can call static methods of a class even if you haven't
created any instance objects of that class.  Static methods aren't
stored on the instance objects, they're stored on the Class object.


-- 
Joi Ellis (TeamB) 
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <3aeb000f_1@dnews>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!cyclone.bc.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews!not-for-mail
References: <3aea6aff_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,5d083c96572bdeed
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-04-28 10:44:02 PST
Message-ID: <3aeb000f_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: How Static method is created by compiler?
Newsgroups: borland.public.jbuilder.java.api
References: <3aea6aff_2@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 28 Apr 2001 10:38:23 -0700
X-Trace: dnews 988479503 209.46.41.66 (28 Apr 2001 10:38:23 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!cyclone.bc.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews!not-for-mail