javap后的一些问题
public class S{
public static void main(String[] args){
StringBuilder sb=new StringBuilder("abc");
}
}
javap后
new #2; //class java/lang/StrinbBuilder
dup
ldc #3; //String abc
invokespecial #4; //Method java/lang/StringBuilder "<init>":(Ljava/lang/String;)V
astore_1
return
问题:
为什么要有dup,dup意思为:This pops the top single-word value off the operand stack, and then pushes that value twice - i.e. it makes an extra copy of the top item on the stack.
ldc后栈内都有那些元素
invokespecial是怎么进行的,简明说下
还有#2 #3都是啥意思
谢谢大家了