G Nadeem

Ranch Hand
+ Follow
since Apr 25, 2003
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 G Nadeem

Hi Barkat,

1) presumabably C is saying, "for a compileable code to compile" and not "for an uncompileable code to compile.". so C is NOT saying that code in its current will not compile.
2) this is possible. however access to super class method functionality is lost
3) this is automatically resolved once '1' is resolved.
i do however agree that some degree of ambiguity does exist in the question.
hope it helps.
Hi Barkat,
if u follow the JLS, option 1 will not be valid. as

An inner class is a nested class that is not explicitly or implicitly declared static

(JLS 8.1.2)
so it would be better to call such class (static nested) 'nested' instead of 'inner'. since once it is declared static it is still nested but not inner any more.
i think JLS suggests to think of inner class the one that is nested and NOT STATIC (and not annonymous too, as that is unnamed).

this expression does not in anyway devalue/dishonour personal preferences and only suggests an approach purly for exam purpose.
[ June 17, 2003: Message edited by: G Nadeem ]
hi everyone.
passed my exam today scoring 93%. JavaRanch. Dan. and Marcus Green. thank u very much for ur great resouces and your support to all who need it. thanks javacertificate.com too which was very helpful. had only dissertation project exprerience in java (~3 months) and then invested 3 months for preparation (5 days a week, ~10 hours a day).
thanks all again.
20 years ago
Well done. hearty congratulations...
20 years ago
Hi Barkat,
No. (As evidenced from above explanations) There is only String[] object (sa) being created in Bt class's main method and same is passed as argument to the constructor of class At. so reference is to same object.
Hi Vamshi,
Good Job. Wov..90%. Congratulations
20 years ago
Congratulations preeti. Keep it up.
20 years ago
Hi Stanislava,
You are right.
Hi Alton,

Well, technically speaking, the term should be shadowing.


If a class declares a field with a certain name , then the declaration of that field is said to hide any and all accessible declarations of fields with the same name in super classes,and superinterfaces of the class

JLS 2Ed 8.3 pp153-154

A declaration d of a type named n shadows the declarations of any other types named n that are in scope at the point where d occures throughout the scope of d

JLS 2Ed 6.3.1 p86.
so i think in above case is that of hiding and not shadowing. am i making any mistake here?..
hi Andres,

Is variable s1 in class B hiding s1 in class A


yes it is.

when you extend a class are you inheriting all non-private members


yes. except those which have hided any super class members.

how's the procedure to figure this out..


only instance methods are overriden.
Super s = new Sub();
s.m(); // will call sub's m IF it is overriden.
on the other hand feilds are shadowed. feilds are accessed using the reference variable type.
Super s = new Sub();// ref var is Super
s.aField; // will access S's aField
Sub s = new Sub();
Super sup = (Sup)s;
sup.aField; // will still access S's aField because the variable 'sup' reference type is Sup and not Sub.
In order to access Super's hidden feilds through Sub refernece, u can 'cast' to Super.
Sub s = new Sub();
int aField = ((Sup)s).aField;// now will access Sup's even if it is shadowed in Sub.
hope it helps.
[ June 07, 2003: Message edited by: G Nadeem ]
Hi dinesh,
though u have not mentioned what exam u are targeting, but it seems u want to take 1.4. Well in that case I/O,AWT and Applet are not there. additions/enhancements found in 1.4 are assertions,collections framework, and equals/hashcode. it is reliable to prepare on the objectives sun itself has declared.
Sun Exam Objectives
hi,
ur help plz...

is the object created at line 2 elligible for GC after line 4 executes.
hi,
u r right Brian. this is because annonymous class does not have a name.


A local class is a nested class that is not a member of any class and that has a name.

JLS 14.3
hi,
we can use it anywhere where an expression is requried.