package javaapplication21;
class A
{
protected String name="abcd";
private void msg1()
{
System.out.println("hello this is msg1 and private");
}
protected void msg2()
{
System.out.println("hello this is msg2 and protected");
}
}
class B extends A
{
public void showname()
{
System.out.println("name is "+name);
}
}
public class JavaApplication21
{
public static void main(String[] args)
{
B a=new B();
a.msg2();
a.showname();
}
}
No comments:
Post a Comment