Ganesh Kumar

+ Follow
since Dec 18, 2006
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 Ganesh Kumar


I have bought the K&B book. I got a CD attached with it. I found there is one master exam in that CD. Also it is mentioned that I will be getting a bonus master exam in the site When I visit the site I could not find the link. Any idea about this? If I get that I can make use of it for my practice. Please reply if you have any idea.

I found after running few samples...

When I compile by having xcom as a current dir then it is searching for xcom package inside xcom(since A should be within the same package. No Imports!). Since it it could not find the xcom folder it says A.class is not accessible.

Am I correct? I am not sure... This is just my idea... Any thoughts?
Hi Friends,

This is the question from our certification book. I am not getting the explanation given. Can any one help me out?

Answer: C

I felt the answer to be B. When I execute B option is say that class A not accessible.


Given the default classpath:

And this directory structure:


And these two files:

package xcom;
public class A { }

package xcom;
public class B extends A { }

Which allows to compile? (Choose all that apply.)

A. Set the current directory to xcom then invoke

B. Set the current directory to xcom then invoke
javac -classpath .

C. Set the current directory to test then invoke
javac -classpath . xcom/

D. Set the current directory to test then invoke
javac -classpath xcom

E. Set the current directory to test then invoke
javac -classpath xcom:.
What is the real time use in making a contructor protected? Can anyone help?
While achieving the Multiple Inheritance, are we losing the code reusability??
Thanks for the reply.

Are you coming to say that Interfaces are not for replacing Multiple Inheritance? Any relationship between interfaces and multiple inheritance?
class C{
void funC(){}

class D{
void funD(){}

class E extends C,D{ // Not allowed in java but assume it works


In the above one, the methods in the classes C and D are reused in E. The same C and D can also be "reused" by any other class by extending them.[Assume multiple inheritance is allowed].

Consider the below code

interface C{
void funC();

interface D{
void funD();

class E implements C,D{
public void funC(){}
public void funD(){}

Here C and D are implemented by E. If I need the same funtionality in some other class I need to implement these interfaces in that class too.I feel that reusability is lost.

How Interfaces is an alternate to Multiple Inheritance if the "Reusability" is lost?

Can anyone please clarify?
Why should there be only one public class per source file?
Thanks a lot for your reply.
This will definitely help me in learning.

Thank You
I am preparing for SCJP5.0. I am following the sun's book(kathy sierra and bertbates). i am half way through now.

the problem i encountered is that many things what i read in previous chapters are not staying in memory for 100%. i understood the concepts. even then when i am visiting the chapters again i could not recollect the topics easily.i dont know whether am i lacking in memory or that is the nature of this.everytime new ideas are coming. what should i do now to improve this? will answering many mock questions solve this problem?

many have finished SCJP.. please HELP!!!
Why only one public class is allowed per source code file? what they are achieving by having that rule?