The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

reply

Posted by Suresh Kumar.R on June 20, 2000 at 8:38 AM

It is working because it is not extented or implemented to any other class/classes.
private/protected class is used for deny the access for the methods/constructers/variables in that particular class from/to any other classes.
Those classes will not work if the polymorphism or inheritence is properly handled in the program.

> I can compile and run the following code. How? Note that instead
> PUBLIC static void main I've used PRIVATE static void main.
> In books it is givn that it main be public inorder for the
> JVM to access it. Even if i make it PROTECTED it works

> public class Test{
> private static void main(String s[])
> {
> System.out.println("test");
> }
> }






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us