This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Class casting and JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Class casting and JVM" Watch "Class casting and JVM" New topic
Author

Class casting and JVM

frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
When downcasting, Subclass = Superclass, what are the many steps occuring behind the scenes within the JVM ?
There is some overhead involved in this action that is best avoided, but I can't find any specific doc on what exactly is happening in the JVM. I don't need the opcodes, although that would be appreciated, but I do want to know each step that would represented by an opcode.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9056
    
  12
You can get the op codes (or at least the byte codes) by using javap -c YourClass.
[This message has been edited by Marilyn deQueiroz (edited November 02, 2001).]


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Thanks again Marilyn.
Yes, the javap -c thing is cool and to get more detail on the byte codes see http://mrl.nyu.edu/~meyer/jvmref/ref-Java.html
although that link is a little old.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9056
    
  12
Another good link regarding bytecodes
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Class casting and JVM
 
jQuery in Action, 3rd edition