Hello Friends I had some problem regarding the private constructor and having the final class. according to Robert Heller the Math class is final (so that it cannot be subclassed) and the constructor is private(so that it cannot have instance). Now the Problem is that i was trying to subclass a class whose constructor is private. it was not working as showing error that constructor is declared private. Programme is as follow: file name B.java
" a nested top level class cannot declare any static variables, static methods or static initializers " why is this statement true? Especially in case of static initializers [This message has been edited by bindu ramesh (edited March 21, 2001).]
when u r accessing a instance variable from the a static method ( main is a static method ) the instance variable must also b static. so u r method invocation would work only if u say f.increase(f.a); else u have to declare a local array of integers in main and then pass it to the method say public static void main(String[] args) { int a[] = new int[5]; f.increase(a); } -- this will not give you the error that a is not static