Hi,Aruna
since the runtime reference refer to the sub class U are getting subclass write method is excecuted.by changing the ref. to superclass as samith told or U can call super class method asin sample code.
code:
class Process6{
Process6(){
write();
}
void write(){
System.out.println(Thread.activeCount());
}
}
class
Test extends Process6{
public static void main(String[] args){
Process6 t = new Test();
//new Process6().write(); method 1
}
//Test(){super.write();} method 2
public void write(){
//super.write(); method 3
System.out.println(Thread.interrupted());
}
}
regrds
vkswami