sean
sean

Reputation: 1832

Static method missing in bytecode

I have a simple program like below:

    public class StringDemo {

          public static String s = "abcdef";

          private static boolean test(String str) {
            if (!str.startsWith("abc")) {
              return false;
            }
            return true;
          } 

          public static void doTest() {
            test(s);
          }

          public static void main(String srgs[]) {
            doTest();
          }
    }

Both test and doTest are static methods, but after compiling to bytecode, I can only see doTest, and testis missing. Can anybody explain for me why? Thanks.

P/S: I can't put bytecode in here, because stackoverflow keeps showing an error "your post is mostly code, please put more details"...etc

Upvotes: 3

Views: 464

Answers (1)

nik
nik

Reputation: 251

you should use javap with -private flag in order to see private methods javap -c -private xxxxxxxx

Upvotes: 5

Related Questions