Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class casting and JVM

 
frank davis
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
frank davis
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another good link regarding bytecodes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic