tags:

views:

136

answers:

5

I want to learn about how things work in depth in Java. Coming from a c# background, there were a couple of very good books that go really deep in c# (C# in depth, CLR via c#, just to name the most popular). Is there anything like that in Java? I searched it up on amazon but nothing seemed to go that deep in Java as the two above go in c#.

I don't want to know more about specific classes, or how to use this library or that other library, I want to learn how the objects are created on memory, how they get created on the stack, heap, etc. A more fundamental knowledge, let's say. I've read some chapters of Effective Java and The Java Programming Language but they don't seem to go so deep as I'd want them to go.

Maybe there are other people that know both c# and Java that have read any of the referred books and know any that might be useful?

Thanks

+2  A: 

Effective Java by Joshua Bloch is about as close as I've found to the two C# titles you mentioned, though it probably won't have the implementation depth you're looking for.

Java Threads by Scott Oaks and Henry Wong talks about the Java memory model, but, as you'd expect from the title, it's mostly about threading.

Tim Trout
I see. Is there any special reason that being Java older than c#, it doesn't seem to exist anything as comprehensive for Java as for c#?
devoured elysium
Mostly because the spec for Java as a language is simpler - Microsoft pushes lots of stuff in at the language level that are done in Java via APIs and third party libraries.
Nate
A: 

I'd second Effective Java from Tim Trout's post - however many of the questions you ask would be addressed in something more like The Java Virtual Machine Specification. However, this book is much "drier" than the two C# books you mentioned.

Nate
+1  A: 

If you want a nice deep dive into Java, I highly recommend Thinking in Java, 4th edition by Bruce Eckel. It was written for Java 5 (JDK 1.5) which was a few years back but at the time of this post, Java has not changed much. the 1.6 JDK was more about performance then any major language changes. I find Bruce's examples a little quirky but his exposition on the language features and why they work the way that do are excellent.

Vinny
+1  A: 

Although old, Decompiling Java looks interesting.

I want to learn how the objects are created on memory, 
how they get created on the stack, heap, etc. 
A more fundamental knowledge, let's say.

For this kind of thing, I'd suggest you pick up a copy of Head First Java. I have a copy of that on my desk right now, and this book does the job of explaining the above very very well. For example, you would hugely benefit from the chapter which explains how objects go on the heap and where the reference variables go based on where they're declared, where local variables go, how stack frames work etc etc.

Zaki
+1  A: 

Much of the information you ask for is not defined strictly by the Java Specification, and may be done differently by different vendors. Hence your question is JVM-specific and not generic.

The simplest full JVM available as open source is most likely JamVM - http://jamvm.sourceforge.net/ - and if you really feel like it the HotSpot JVM is also available as open source - http://java.sun.com/docs/hotspot/HotSpotFAQ.html

Thorbjørn Ravn Andersen