-
private method access confusion
when i execute subtest class using java2 , the following code is
running successfully and giving the output message " main executed" .
how can a private method of superclass is being accessed in sub class?
can anybody clarify me?
-------------------------------
public class subtest extends test {
}
class test {
private static void main(String args[]) {
System.out.println("main executed" );
}
}
-
Re: private method access confusion
It's not a matter of inheritance. The Sun JVM itself
doesn't require that the main method of a class be
accessible. It can be private. There is debate
on the Sun web site about whether or not this
behavior is a problem. The JVM implementation
does not seem to be in concordance with the Java
Language Specification (section 12.1.4).
See the bugs with IDs 4252539 and 4155575
at
http://developer.java.sun.com/develo...s/4155575.html
and
http://developer.java.sun.com/develo...s/4252539.html
---Russell Johannesson
"prabhak" <pp_reddy@yahoo.com> wrote in message
news:390499cc$1@news.devx.com...
>
> when i execute subtest class using java2 , the following code is
> running successfully and giving the output message " main executed" .
> how can a private method of superclass is being accessed in sub class?
> can anybody clarify me?
> -------------------------------
>
> public class subtest extends test {
> }
>
>
> class test {
>
> private static void main(String args[]) {
>
> System.out.println("main executed" );
>
> }
>
> }
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks