I'm a Java developer since 2002 and recently I noticed that my knowledge about the JVM was bad. So I started to read some things in the JVM specification. Ofcourse subjects like opcodes/bytecode are discussed. I liked those opcode instruction code, but how useful is it to have (some) knowledge about that?
Are there any advantages of knowing opcodes and be able to read it? Can it improve my java skills in general? Just curious
No, the JVM specification is nice to know if you need to or want to implement a JVM. A general peek at some parts might be useful to understand if something is defined as a specification or is just an implementation detail. But generally no - knowing or reading the JVM spec is not important to your Java skills, and knowing opcodes and what not is not going to help in any way.
If you are going to use the ASM library, you will need to know opcodes (although there are ways of using ASM without learning all the opcodes.. it has a utility that will generate opcodes from a template for you) Besides that you shouldn;t really need to know opcodes
I have to say that knowing opcodes makes you sound like a badass, though. So, if you have time to learn it, you might want to learn them just for the bragging rights.
I understand that for example opcode aload_0 has hex representation 2A and means 'this' and that this by itself is not very important to know. But can viewing opcode instructions be useful for things like debugging? It's hard to find some uses of opcodes/bytecode, so probably is not that exciting...
I would not have thought reading opcodes is any good for debugging. The people who need to know opcodes are compiler writers, and similar. If you are trying to compile an Eiffel program, for example, so it runs on a JVM, you need to know the opcodes to put into your compiler.
The JDK includes a tool, javap, with which you can disassemble class files (use the -c option to do that). You'll get to see the implementation of methods in the form of JVM assembly language, with opcodes.
Sometimes it's useful to be able to understand what happens exactly in a class, but I wouldn't say it's really an important thing to know for most Java developers.