Matt Russell

Ranch Hand
+ Follow
since Aug 15, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Matt Russell

Originally posted by Rashi Jain:
But most of them I saw were having something like GPL license. So we can use the material as we want, no?



In Inquisition, the bundled exams are either in the public domain or provided under a variety of Creative Commons licences (for example, the Creative Commons Attribution-NonCommercial-ShareAlike 2.5) chosen by their authors. You can use the questions as long as you comply with those licenses.

Originally posted by Ernest Friedman-Hill:
Well, so you've learned something about what test preparation material not to use. "null" is of course the correct answer.


I'm sure there are still errors in Inquisition's question banks, but in this particular case that question was fixed in the most recent release of the engine (last June). So if you are going to use Inquisition, please grab the most recent version!
Looks like it's an issue with the localisation (language translation).

Try running it explicitly telling it the language and region, e.g.:

java -Duser.language=en -Duser.region=US -jar santis_JCP.jar

[Ah, I see you've already fixed it, sorted!]
[ July 12, 2008: Message edited by: Matt Russell ]
Yep, that's a bug -- I'm guessing you must be running an old version (< 0.14) of Inquisition, because that error was fixed in the release last month.
Looks like it's just a mistake in K&B. It's not in the errata, though, although a typo on the same question is.

Originally posted by Noam Wolf:
@Russel - the ArrayStoreException happens for the non-generic example... try it out.



I did. It doesn't compile.
We can interpret ArrayList<? super B> to mean that the list contains elements only of some specific unknown type, but we do know that the type is either B or a superclass of B. An ArrayList<A> would fit, but so would an ArrayList<B>. Therefore you could have written this for line 1 instead:

In this case, it's clearer why line 2 fails -- it's trying to put something that's not a B into a list of B's. It fails to compile in your original example because the compiler doesn't really know exactly what the specific type of l2 is, so it behaves pessimistically.

Originally posted by Noam Wolf:
You will get a runtime ArrayStoreException on line 2.


Actually, I believe you'll get a compile time error on the previous line.

Originally posted by Dinesh Tahiliani:
can you please provide me the link of JavaDoc Float.equals()
I willbe thankful to you



Just wondering what was wrong with typing "javadoc float" into Google?
You need super.add(o), rather than super.o. That will call the implementation of add() in HashSet, the superclass of Group, and will add the person to the HashSet. There's not much point to the override, as the HashSet add() method would have been called in any case.
Because you're extending a generic version of HashSet, you need to override the add method with a Person argument, not an Object, like this:
The following should do the trick:

The thing to know is that you need an instance of the outer class before you can create an instance of the inner class. (That's what the odd-looking "line.new Point()" syntax is all about.)
You need to make Item implement Comparable<Item>, not just Comparable (which is a raw type). That is:

Originally posted by John Meyers:
They are not eligible for GC unfortunately. Search the forum, this topic has been discussed before. The island is by itself not reachable but the references point to each other and the JVM thinks that these references can be reached since they point to each other circularly



As I had understood it, the "island" is eligible for garbage collection, despite the circular references, because none of the objects are reachable.
The syntax to chain constructors is to use this, so replace:

with

and the code will compile.
[ June 14, 2008: Message edited by: Matt Russell ]