Sahil Kapoor

Ranch Hand
+ Follow
since Sep 12, 2009
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 Sahil Kapoor

There is one class Car and another one called Tyre. Now , with the destruction of the Car object we want its associated tyre(s) to be destructed with it. Consider the following code

class Car {
Tyre t ;

Car( Tyre t1 ) { t = t1; }

class Tyre {

class Test {

Tyre t = new Tyre();
Car a = new Car(t);

a = null ; // I have destroyed the Car Object , but i can still refer the tyre object through t reference.


Problem : - I want to do something so that i can enforce this thing that whenever i make car reference equal to null then there is no way to access tyre(s) associated with it.
How would i achieve this or enforce this ???

13 years ago
Thanks Unmesh for all your help !!!
13 years ago
Thankyou so much all of you !!!

and i really dont have any idea about dumps !!! What prasad is saying is true , i am also shocked that dumps carries real eam questions screenshots. Thats ridiculous and
if any one get certification like this , it is of virtually no gain.

For those who are new to java !!!

Learn java from "Head First JAVA" (an incredible book i have ever seen) , then do Kethy Sierra and Berta Bates book for SCJP, followed by mock exams.
I did "Khalid mughal " too but , as far as SCJP exam was concerned , that book actually diverted me from the focus of clearing SCJP . I am not saying that it is not a good book , it is a also an incredible book and infact i would complete all topics from it, but as far as SCJP is concerned , just two books are sufficient . HEAD FIRST JAVA ----> K&B SCJP .

Thankyou Bert for your wishes. I just wanted to say that , i think you need to explore the topic of "Coupling and Cohesion" in K&B as , the question from this topic made me less confident .
Question was to reduce coupling between two classes.

I thankyou for such an incredible books thats make clearing SCJP a cake walk.

Happy Learning JAVA !!!
13 years ago
My reply is based on my particular exam, i dont know if it comes difficult for you, so please do consider this point too while reading the following.


No Questions from Serialization Topic, wait, notify and notifyAll.


Exam was really too easy . I did it in 1 and half hours.

Just basic concepts are sufficent.

@Prasad Kharkar

Thankyou man and ya the above list is not in accordance to Priority . That is just numbered.
But you dint considered one thing in the above list , let me tell you , i have included your name twice in the above list . The top one is because of the fact that you boosted my confidence when once you said that "Sahil you would get atleast 95 % ".
Second one is for your help !!!

13 years ago
Thankyou Jan !!!
I was waiting who would be the first one to respond !!!

Thankyou so much !!!

13 years ago
Oooops , I was fine tuned with most of the ins and outs of SCJP with the help of many savvy guys out here. Unfortunately , i got a "DENGUE fever" and was Hospitalized for 20 days.
I got frustrated , and , after that it was just 1 week to reconstruct everything and it was a real time bound on me , that was mandatory to be followed.

I was bit unsatisfied because my tune with JAVA seems to be not so well as it was before "Dengue Fever". Moreover i just did 3 Mock tests (Master Exam). I wish i could do "Exam Lab too".

Nevertheless, i appeared and got 96%

I want to thanks everyone here and to name a few

1. Prasad Kharkar
2. Henry Wong
3. Ankit Garg
4. Sandra Bachan
5. Unmesh Chowdhury
6. Prasad Kharkar
7. Jeanne Boyarsky
8. Deepak Bala
9. Ulrich Vormbrock
10. Shruti Rao
11. Sandhya Parmar

and and and "this is big one" Kethy Sierra and Bert Bates for such an Incredible book, especially "Head First JAVA".

Moreover, i found "CERT PAL" a great site for preparing SCJP 6. Thanks to its owner. If i am not wrong he is "Deepak Bala".

Thankyou !!!

Happy Learning !!!

13 years ago
By default compiler puts super() !!! ie no argument constructor call to Super class.

Essentially , what compiler sees is the following

Tell the output of the following two Programs ???

Reference to Rules !!! SCJP Question of the Day !!!


Hello Joe

Just see, where main method is being declared, if it is decalared in a class that extends some class....then all classes are loaded from Object class to your class....
What happens after that , you know it...

As a Test: Please do check the behavior by declaring the main method in test class....!!!
Also see results when class Individual is marked final......
According to disables assertions from packages starting from com...... .
After thsi i really want to write something in hindi...because i can only release my frustration in HINDI !!! but public etiquetes is restricting me....
Ya while i was answering your reply....i was also having doubt related to Assertions but it was different from you....It was related to packages....
Still not answered what did i asked there ???
Okay that i got it from your first post when you said, packages STARTING from com....

But i m concened about "where does java looks for com "

Does it relates to CLASSPATH or just current working directory from where java is invoked ???

"Ha ha ha" ==> Seems frustrated from java semantics.....Sometimes i also do......But we are users of Java and we have to comply with Java Rules !!!
May be if you would design something, you may design it in abetter way.

Let me try to explain it again....

when you say

java -ea -da:Prateek <some class having main method>

You say, enable assertions in general but disable it for Prateek class ONLY. What does this mean is , hey compiler during execution of my current application...if you find any class other than
Prateek, and it has assertion statements, then do execute them as well , but please do not execute it for Prateek class ( as he is already frustrated and can Blast )