Ankit Dhebar

Greenhorn
+ Follow
since Feb 09, 2009
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 Ankit Dhebar


Can anyone help me outwith comparator and comparable interfaces ?
With simple (easier) example !!
Please !!!

Thanks in advance !

Can anyone please tell me from where can I find Devaka Coorey's Exam questions ?

I really need them !!

Thanks !
Hello Friends,

I have finished reading all the chapters from kathey sierra and bert bates.
Now I want to start off with the test.
I dont have any questions.
Can anyone please help me ?

Thanks !

Ruben Soto wrote:

Ankit Dhebar wrote:Thanks a lot to all for helping me !


Glad that was useful, Ankit!



Yes it was !!!

Thanks a lot to all for helping me !!
Thanks a lot to all for helping me !
Hello Can anyone please explain me the below code step by step otherwise It becomes difficult for me to understand.



Thanks !
Ok !! I will do it.
Thanks
Thanks for your help can you explain me with a small example.


Thanks .

Thanks a lot James Really appreciate your help but can you explain me with a small simple example .
Thank You.
Hello ,

Can anyone explain me what actually does this mean ???




I have been reading Kathey Sierra and Bert Bates but still I am not clear with it.I even tried on internet still facing problems.
I just want to know what does this line mean and what should i consider when i see this line ??
What should come into my mind??

(Thanks in advance)
OK !! I am sorry from next time I will use Code button.
In the Code what i didnt understand is functioning of following block.



I have got this example from BertBates and Kathey Sierra.
Thanks alot harsh I really appreciate your help.You really explained very well but the point at which i get stuck is

static class ReSortComparator
implements Comparator<String> { // #6
public int compare(String a, String b) {
return b.compareTo(a); // #7
}
}
}

We are never invoking the above class !! Then how is it getting invoked and
what are the 2 arguments we are passing as first 2 strings can you explain me this.
How's compare() geting invoked ?
And what are the first 2 args passed to compare how does it sort ??
Alphabetically or it converts that into primitive ???

(Thanks in advance)


Hello friends,
Can anyone explain me in easy language-step by step how's is this program working !!

import java.util.*;
class Dog {
public Dog(String n) { name = n; }
public String name;
public boolean equals(Object o) {
if((o instanceof Dog) &&
(((Dog)o).name == name)) {
return true;
} else {
return false;
}
}
public int hashCode() {return name.length(); }
}
class Cat { }
enum Pets {DOG, CAT, HORSE }
class MapTest {
public static void main(String[] args) {
Map<Object, Object> m = new HashMap<Object, Object>();
m.put("k1", new Dog("aiko")); // add some key/value pairs
m.put("k2", Pets.DOG);
m.put(Pets.CAT, "CAT key");
Dog d1 = new Dog("clover"); // let's keep this reference


m.put(d1, "Dog key");
m.put(new Cat(), "Cat key");
System.out.println(m.get("k1")); // #1
String k2 = "k2";
System.out.println(m.get(k2)); // #2
Pets p = Pets.CAT;
System.out.println(m.get(p)); // #3
System.out.println(m.get(d1)); // #4
System.out.println(m.get(new Cat())); // #5
System.out.println(m.size()); // #6
}
}


which produces something like this:
Dog@1c
DOG
CAT key
Dog key
null
5