Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Sarika Chavan

+ Follow
since Feb 14, 2014
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 Sarika Chavan

Sorry, but I had word file list...I tried to paste it here..but not properly aligned. So made an image file.
Will try to paste as text.
Hi Ravi,

This is the list which I had prepared for my OCPJP preparation. Hope it helps you.
Gone through some previous posts and my doubt is cleared now.
This que is resolved now.

This question is from Examlab Practice 2

Output is: examlab

Can anybody explain me what is the meaning of "[@.]" expression.
How it's applied to given string?

Paweł Baczyński wrote:Nowadays they do not send you your certificate unless you specifically request it.
So you can pass your exam in Belgium and then request for a printed copy later to any address you want.

That's good.
Thank you Paweł Baczyński for your reply.
I am preparing for certification and probably give exam in next month.

Currently I am living in Europe(Belgium) and want to give exam from here.

But I am not sure how long I will stay here after my exam.My tenure is not fixed.

My question is that, can I give my India address(Which is permanant) while registering at Pearsonvue and give exam in Belgium. So that I can receive my certificate on my permanant address.

Is it possible to do like this?
Thank you Paweł Baczyński for your explaination.

I understood it now.
Kindly help me to figure out difference between following 2 code blocks.
Why one runs properly and other not.


1. For 1st block it throws IllegalMonitorStateException.
Whether object locking is incorrect here?

2. This block runs fine.

Thank you Madhav for your help.

I read some previous posts about this concept in the forum and got some idea.

I read When you are using wildcard List<? super Dog> it means you can pass any type that is Dog or superclass of Dog and we can add anything that is of type Dog or any subclass of Dog

Means at the time of passing argument type matters, but while adding elements it follows polymorphic rule.

Is this correct?

If it is, my doubt will be cleared
Henry, Thank you for explaination.
Still not fully satisfied.
Will try to read more about it.
Please correct me, if I understood wrongly.

Henry Wong wrote:

Sarika Chavan wrote:
According to me...Cat is not supertype of dog, and Whitedog is lower in inheritance.
adding Cat or Whitedog should throw an error.
But why it is working?

Can you first tell us which class types should work? ... because your assertion is wrong. Adding Cat to a List<? super Dog> should fail compile, but adding Whitedog should work fine. Also, adding Animal or Object should also fail.


Hello Henry,

According to me <? super Dog> means Dog and any supertype of Dog (e.g Animal) should work.
But Cat (same inheritance level) and Whitedog(lower in inheritance) should not work.

Am I correct?

I have doubt in following lines.

1. anm.add(new Cat()); // this does not show any compiler error to me..runs fine

2. anm1.add(new Whitedog()); // here also same.

How does it work?
I need some explaination about wildcard <? Super >

I am confused with the example given in book SCJP6 K&B. page no. 619.

Here it is.I modified it for my understanding.

This part is ok.For code below, use of <?super> is done.

Book says meaning of this as," Accept any List with generic type that is of type Dog or a supertype of Dog,
nothing lower in the inheritance tree can come in, but anything higher than Dog is ok.".

with this explanation, above code works good, and I understood it.

But I made following changes in my code(for understanding how it works.

According to me...Cat is not supertype of dog, and Whitedog is lower in inheritance.
adding Cat or Whitedog should throw an error.
But why it is working?

I am confused with book explaination and my code.

Please help.
Sorry for not giving source of my question.

I got this from one of the mock exams.


Question no. 5
Thank you very much Tim Cooke.
Now it's clear..