Article View: borland.public.jbuilder.java.language
Article #595Re: static class
From: John McGrath [TeamB]
Date: Tue, 22 Mar 2005 17:12
Date: Tue, 22 Mar 2005 17:12
46 lines
1932 bytes
1932 bytes
On 3/22/2005 at 3:35:33 AM, Petar Popara wrote:
>
> What is a difference between static and non-static class?
>
> Example:
>
> class MyClass {
>
> }
>
> static class MyStaticClass {
>
> }
Well, unless you included the above code inside another class, the main
difference is that the first would compile and the second would not. The
static modifier can be applied to class members, not to top-level classes.
So lets say we have the following:
class TopLevel {
:
:
class MyClass {
}
static class MyStaticClass {
}
}
Both classes are nested classes, since they are declared within another
class. But MyClass is also an inner class, whereas MyStaticClass is not.
You will need to get a good Java book for more detail on inner classes.
This is too broad a subject to cover in a newsgroup message.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<xn0e01zeo2k9irk001@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<423fd8a7@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,44d10620d7709ba X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: static class Newsgroups: borland.public.jbuilder.java.language References: <423fd8a7@newsgroups.borland.com> User-Agent: XanaNews/1.17.3.1 Message-ID: <xn0e01zeo2k9irk001@newsgroups.borland.com> X-Ref: newsgroups.borland.com ~XNS:00000305 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.201.155.159 Date: 22 Mar 2005 09:12:01 -0800 X-Trace: newsgroups.borland.com 1111511521 151.201.155.159 (22 Mar 2005 09:12:01 -0800) Lines: 46 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail