mythili sharan

+ Follow
since Sep 23, 2004
Merit badge: grant badges
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 mythili sharan

This is a qn from exercises from K&B. I have a doubt abt the answer. I thought it shud result in a compilation error because a static variable is being used in a non-static method void twice(int x). Can anyone explain.

This question too is from Marcus green's mock exam.
when we extend thread or implement runnable-- isnt it necessary to define the run method?? I can compile and check but what confuses me is how to tackle such a basics- shattering qn in the exam.

I thought the answer would be 1 but it is 4.

[ September 24, 2004: Message edited by: Barry Gaunt ]
Thanks so much Tom.. the topic is now "claritin" clear. I shall never get such a question wrong again.
Hi This qn is from Mindq.

I have a problem understanding Super sup = new Sub();
If any class has a superclass then the superclass constructor will be called while creating an object. so in this case a super object will be created even if sub constructor is called.
sup.index will be 5 and
sup.printVal will print super

but the answer is
c) The code compiles and "5, Sub" is printed to standard output.
Can anyone please explain where i am wrong in my understanding.