Ignacio Cavero

Greenhorn
+ Follow
since Dec 10, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ignacio Cavero

I read the KB book and I don't remember reading anything about those, but checking out a test exam from the sybex book I found many questions about them. Should I study those?
I suppose you are talking of the method of the List interface which returns the last index of the specified object (you can have the same object multiple times in a List, something that can't be done on a Set). I did a test code to show you, I was testing enums so I reused that code for this example, hope you are not using 1.4

You are using the new A(Thread t) constructor for A that it is inheriting from the Thread class. Because of that, without noticing you are starting the run method of the runable Object B instead of the run method of A.
It's going to happen the same thing in java 1.4 or 1.5, java is designed to be backwards compatible. In both cases the == compares if the primitives have the same value, or if the references both point to the same instances of the object (to know if two different instances both represent the same object you must override and use the .equals method defined in Object)