... and as an extra incentive, you'll receive a coupon for $250 off any Intertech training course in 2010 - just for completing the survey!
Azure In Action Book Review
1 year ago
package com.intertech.examples.java.accessmodifiers;
public class Parent
{
public void printPublicMessage()
{
System.out.println( "printPublicMessage()" );
}
protected void printProtectedMessage()
{
System.out.println( "printProtectedMessage()" );
}
void printPackageMessage()
{
System.out.println( "printPackageMessage()" );
}
private void printPrivateMessage()
{
System.out.println( "printPrivateMessage()" );
}
}
package com.intertech.examples.java.accessmodifiers;
public class Child extends Parent
{
// Does nothing but extend Parent
}
package com.intertech.examples.java.accessmodifiers.another;
import com.intertech.examples.java.accessmodifiers.Child;
import com.intertech.examples.java.accessmodifiers.Parent;
public class AnotherChild extends Parent
{
public static void main( String[] args )
{
Parent parent = new Parent();
/* which "Print" methods from the Parent class would be visible for this Parent object? */
Child child = new Child();
/* which "Print" methods from the Parent class would be visible for this Child object? */
AnotherChild anotherChild = new AnotherChild();
/* which "Print" methods from the Parent class would be visible for this AnotherChild object? */
}
}
