hi all
The problem is with the line (1)
class Parent
{
void method1()
{
System.out.println("Parent's method1()");
}
public void method2()
{
System.out.println("Parent's method2()");
method1();
}
}
class Child extends Parent
{
Child()
{
//method2
}
public void method1()
{
System.out.println("Child's method1()");
}
public void method2()
{
System.out.println("child's method2()");
method1();
}
public static void main(
String args[])
{
//Parent p=new Child();// (1) when i invoke the line (2) with this line uncommented it throws error saying can't resolve symbol why it so.since the instance type is child why it throws the error
Child p = new Child();
p.method2();
int[] a={1,2,3,4,5};
p.arr(a);
for(int i=0;i<a.length;i++)
System.out.println(a[i]);
}
void arr(int b[])
{
for(int i=0;i<b.length;i++)
System.out.println(b[i]);
}
}