I was thinking of a task of creating my own Java Decompiler. The methods, contructors and fields can be obtained using the Java reflection API. But how to get the functionality that is writtn inside the method, contructor.
Moreover I have seen the decompiler retrives even the comments.
So,for that, do I need to understand the byte code, or Java API provides some mechanism to do so?
In the Cookbook I talk about the Reflection API, which you can use to write the easy part of javap. It has methods like getMethods(), getFields(), getConstructors(), etc. and is actually one of the fun parts of Java. I jokingly refer to certain other books that are mostly API cross reference generated mechanically using Reflection, saying "I show you how to write their book, but they don't show you how to write mine".
That said, the reflection API does not give you access to the bytecode, which you would need for the decompiler project. You could maybe play games with a ClassLoader to get it, there's no need to; as has been pointed out, BCEL provides a toolkit specifically for dealing with bytecode files.