The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001

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:

Please explain me about this example!

Posted by hcsong on July 25, 2001 at 7:57 AM

package Greek;

class Alpha {
protected int iamprotected;
protected void protectedMethod() {
System.out.println("protectedMethod");
}
}


//////

import Greek.*;

package Latin;

class Delta extends Alpha {
void accessMethod(Alpha a, Delta d) {
a.iamprotected = 10; // illegal
d.iamprotected = 10; // legal
a.protectedMethod(); // illegal
d.protectedMethod(); // legal
}
}

Q.How can i understand above thing?
I think that a.iamprotected = 10; // legal and a.protectedMethod(); // legal


Thanks.






Replies:

Sponsored Links



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