Krishnakumar

Greenhorn
+ Follow
since Mar 15, 2005
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 Krishnakumar

Ok thats chear...then, why is it that making the withDraw method of Account class not solving the problem either..?
Thankyou all!!

Deshdeep. Don't worry so much abt it. Questions will be generally easy. But read and re-ready K&B atleast 2 times. That will be sufficient. I read the book once very thoroughly before starting the mock tests..Then 2-3 days before the exam read once again. And on the day of the exam, read the exam watch and 2 min drill...

All the best for you exam..!!
19 years ago
Just passed with 93%...Questions were quite easy. But I found the questions on Garbage Collection and Thread a bit confusing (I scored the least in these two). And for those 4 answres that were wrong, it was like 5-6 options and chose two/three...

And at the bottom of the screen there is something that's written...

"Select the best answer(s)"

And I found all of them equally good...

For the remaining sections I found the questions to be easy...Just work on a few mock tests and you will be thru...you can score 100% if you really concentrate on the question...Some of them were straight from K&B...

If you really want better score work more on GC and Thread questions...

All the best!!!

-Krishnakumar
19 years ago
Question 1
----------

If I write a code like the one below why does it not give a compilation error. If I change Exception to IOException it does throw a compilation error.





Question 2
----------

If an IOException is thrown, then even an Exception can catch it because it is its super class. Then why not an Object.

Sorry I just wanted to ask that question...

So if I have an interface within a top-level class, is it implicitly static..?
This words are from Khalid Mughal's notes...

A static member class or interface is defined as a static member in a class or an interface. Such a nested class can be instantiated like any ordinary top-level class, using its full name. No enclosing instance is required to instantiate a static member class. Note that there are no non-static member, local, or anonymous interfaces. Interfaces are always defined either at the top level or as static members.

So if I have an interface within a top-level class, it is implicitly static
Thanks Steve and others for your response..
Hi Kedar, Would you mind explaining the second case in detail. It is still not clear to me.

Thanks!
One more question please..

If I make two changes to the above code, Test 1 returns false though there is no relationship between C1 and C2.



Okay, now Test 1 results in a compilation error. It says inconvertible types because there is no relationship between C1 and C2. (Maybe we can cast ref to (Object)ref to solve the compiler error...)

But my question is why does Test 2 also not show a comilation error..? Because C1 has not implemented I

Thanks!
Sorry friends,

Pl use this formatted code....

Hi,

I have read that if you do not override the equals method in your class and if you use two objects of that class in the equals method, it will use the equals method of the Object class. It does nothing but a == comparison to return the value.

Taking the examples below:



I know that the compiler does not check if the equals method has been overridden meaninfully etc...It sees that there is an inherited version from the Object class. If this version uses a == comparison how does it return a false. Because when you do it yourself it throws a compilation error.
Is it correct that a return statement can suppress an exception?

Arvind, did you check that the code you compliled did not have the catch block. The code you have posted is not having a catch block and does not declare to be throwing it also. So can you pl check...
Hi..

Even if u give a return there, it would give a compilation error because the IOException is still not handled. It has to be either caught in the action method or passed to the caller. Pl check.
I got the answer..! It is because there is runtime polymorphism happening here when you call ((B)this).prn(); and it becomes a recursive fn calling itself again and again,...finally resulting in the exception...