Code generation compiler
I am getting more interest after reading this
as suggested in the IBM developerWorks journal, "Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer."
After reading above page i want to ask,
The terms Mnemonic,opcode,etc use in java byte code, same as System programming. Then why not we can see what is java bytecode generated by our java program. Is there any tool for that.
Is we read source codeuse in the binary Java classes? I read this term in following links
Byte Code Engineering Library
I really confuse reading so much about java byte code but cant read simple java program's (which calculate 1+1=2) java bytecode. If system programming can done by human then is this also possible?
If it isn't I can tell you that java byte code is like asmbler for stack mashine, and you can find a lot of 2+2 examples.
Sorry, I have just noticed that I didn't understand you quite well. You have just asked why we can't read class files. Sorry. There were some java decompilers around, maybe one could use them to decompile a class file, but I am not sure if java byte code is what they produce.
Actually I already used decompiler once but if I remeber good I got only classes and methods names fromt it.
[ July 19, 2008: Message edited by: denis sorn ]
This article talks a bit more how to use javap, as does this one.
Note that while there are people who code in assembler, I think there are very few, if any, who code in bytecode.
[ July 19, 2008: Message edited by: Ulf Dittmer ]
It is absolutely true that knowing bytecode is as important for Java programming as assembler is for C programming. But what they don't tell you is that knowing assembler for C programming is as important as knowing the rules of the road is for fishing. That means: not at all.
You can program C without knowing any assembler and you can program Java without knowing any bytecode.
As you ask
Where did you get the quote about bytecode and assembler from, Mandar Khire?
I read it on wikipedia
So i ask the above question for improving knowledge. Am i mistaking?
Particularly about the relation between length of bytecode and performance.
According to Brian Goetz (here) optimisation in Java is now done by the JIT (just-in-time) compiler in the JVM, and performance is variable from computer to computer. He says that writing simple code is the best way to get the JVM to optimise your code.
Although it is interesting to understand how bytecode works [it is very similar to assembler], and it is always useful to get additional knowledge, I still agree with what it said in Wikipedia that you don't have to know bytecode or assembler to program Java or C/C++.
I always believed knowing assemblier only ever became useful if you were having to optimise, for example knowing the shift operation would be quicker then a (power of 2?) division or multiplication. Thats sort of thing.
Just my thoughts