Mayuri Son

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

Recent posts by Mayuri Son

Oops, I am sorry, Yesterday I was trying this but dont know why I was getting errors, But now working fine as per Dan's example. Sorry again!
Thanks Dan for the example.
Can we access superclass variable of the same name as one in the subclass using keyword super?
Let me explain clearly. If I have a superclass and there is a variable, with identifier i. Now if "subclass" extends "superclass" and has a variable named i. So is it possible to access superclass variable i using super.i (As we were doing in C++)
I have a book, it says "super is used to refer to the members of superclass, both data attributes
and methods"
But when I tried in a java program and it gives me errors
Thanks in advance
Thanks Yan,Ron for the correction.
Correct me if I am wrong
When a class is loaded, first all static members are initialized, then all static blocks are executed in the order of declaration.
But when the class is instatiated then if this class is derived from some superclass
then the instance initalizer(s) of superclass(es), then constructor(s) of the superclass(es)
then instace initializer of the class and finally constructor of the class is executed. And as Hetal said static blocks are not executed at the time of instatiation only at the time of loading