bytecode - Incomplete java byte code -


hi have follwoing java code,

public class a{ private string b="test_string"; private int aa; public int c; private int method1() {     int a;     a=0;     return a; }   private int method1(int c, string d) {     int a;     a=c;     return a; } } 

but when used javap -c command equivalent byte code get,

    compiled "a.java" public class extends java.lang.object{ public int c;  public a();   code:    0:   aload_0    1:   invokespecial   #1; //method java/lang/object."<init>":()v    4:   aload_0    5:   ldc #2; //string test_string    7:   putfield    #3; //field b:ljava/lang/string;    10:  return  } 

i not clear byte code here, because private variable , method declarations?

can explain me?

you need -p option show private members:

javap -c -p 

you'll see everything:

compiled "a.java" public class {   private java.lang.string b;    private int aa;    public int c;    public a();     code:        0: aload_0               1: invokespecial #1        // method java/lang/object."<init>":()v        4: aload_0               5: ldc           #2        // string test_string        7: putfield      #3        // field b:ljava/lang/string;       10: return            private int method1();     code:        0: iconst_0              1: istore_1              2: iload_1               3: ireturn           private int method1(int, java.lang.string);     code:        0: iload_1               1: istore_3              2: iload_3               3: ireturn        } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -