// Java program to illustrate
protected modifier
package one;
// Class A
public class A
{
protected void display()
{
System.out.println("Welcome to softhunt.net");
}
}
// Java program to illustrate
protected modifier
package two;
import one.*; // importing all classes in package one
// Class B is subclass of A
class B extends A
{
public static void main(String args[])
{
B obj = new B();
obj.display();
}
}
package two;
import one.*;
class B {
public static void main(String args[])
{
A obj = new A();
obj.display();
}
}