bindu ramesh

Greenhorn
+ Follow
since Mar 15, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bindu ramesh

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

class A
{
private A(){}
}
class B extends A
{
}
" 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