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
you should use javap with -private flag in order to see private methods javap -c -private xxxxxxxx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With