this is the .class
----------------------------
class Screen {
public static void main(String[] args) {
String s1 = "abc";
String s2 = new String("xyz");
} }
---------------------------------
this is bytecode of Screen.class
---------------------------------
Compiled from "Screen.java"
class Screen extends java.lang.Object{
Screen();
Code:
0:aload_0
1:invokespecial#1; //Method java/lang/Object."<init>"
)V
4:return
public static void main(java.lang.String[]);
Code:
0:ldc#2; //String abc
2:astore_1
3:new#3; //class String
6:dup
7:ldc#4; //String xyz
9:invokespecial#5; //Method java/lang/String."<init>"
Ljava/lang/String
V
12:astore_2
13:return
}
-------------------------------------
see the line 3,7,9
3---create the instance of vlass String
7---push string xyz
9---this method <init>initial instance which make at line 3 to 5.
please correct me if required.