Maybe we rarely use the JavaP tool, because there are now many good anti-compilation tools, but I will introduce this tool not to use it to make anti-compilation, but to see the Java compiler to generate the byte code for us, Bytecode and source code, we can find a lot of questions, a very important role is to understand the work mechanisms inside the compiler, in several articles in the past, this tool, this site has these articles "In-depth analysis of Java classes" and "use String or StringBuffer". Below we will simply talk about the role of this tool through a specific example, you don't need to use deep use, this simple introduction and simple use can make you benefit too much.
Source code: class stringtest {public static void main (string "args) {string result =" "; Result =" OK ";}} You must first compile this class before the anti-compilation: Javac -g StringTest.java (Use the -g parameter because the output is required to get the following javap -L needs to use this option) After the completion is completed, we use different options to see different effects: 1, let's take a look at the simplest parameters : JavaP StringTest: Compiled from StringTest.javaclass StringTest Extends Java.lang.Object {StringTest (); public static void main (java.lang.string []);} If the parameter will promise the PUBLIC information, including members And the method we identified two knowledge from the output: If the class is derived from other classes, it is derived from Object; if there is no application constructor for class, then the compiler will generate a default for it. Construction method (without parameters) 2, javap -c stringtest: compiled from stringtest.javaclass stringtest extends java.lang.object {stringTest (); public static void main (java.lang.string []);} method Stringtest () 0 aload_0 1 invokespecial # 1