The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 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:

Clear Question

Posted by John Lee on November 17, 2000 at 11:55 AM

Thanks for your explanation.

Actually I didn't make my question clear,

-----------------------------------------------------
package mylib;

class DirectAccess {
public Integer var = new Integer(10);
}
-----------------------------------------------------

When we compile class "DirectAccess", should we get some error like:

DirectAccess.java:4: The access specifier for class supersedes that of its variables,
so the access specifier of member var can only be protected, default, or private

public Integer var = new Integer(10);
^

I'm suggesting to make the compiler smarter.

Thanks,
John



Replies:

Sponsored Links



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