read the code following(scjp_2_81).
//****************code1(scjp2_81)***********************//
abstract class Base
{
abstract public void myfunc();
public void another()
{System.out.println("another method");}
}
public class Abs extends Base
{
public static void main(
String arg[])
{
Abs a=new Abs();
a.method();
}
public void myfunc()
{System.out.println("My func");}
public void method()
{myfunc();}
}
//****************code2(scjp2_88)********************//
abstract class MineBase
{
abstract void amethod();
static int i;
}
public class Mine extends MineBase
{
public static void main(String arg[])
{
int[] ar=new int[5];
for(i=0;i<ar.length;i++)>
System.out.println(ar[i]);
}
}
//****************************************************//
the code_1 will compile and print out "my func";(but the myfunc is abstract ,will the Abs declare as abstract ?);
why the code1 compile while the code2 not ,the code2 complain that "the Mine must be declare abstract";
I had thought that a class that contain an abstract method must itself be declared as abstract. Any class derived from an abstract class must either define all of the abstract methods or be declared abstract itself.But now I not so sure .