Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String s = "Mahendra" + "Singh" + "Dhoni";
- String s = "Mahendra";
- s = s + "Singh" + "Dhoni";
- String s = "Singh";
- s = "Mahendra" + s + "Dhoni";
- public static void main(String[] args) {
- String s = "Mahendra" + "Singh" + "Dhoni";
- System.out.println(s);
- }
- public static void main(java.lang.String[]);
- descriptor: ([Ljava/lang/String;)V
- flags: ACC_PUBLIC, ACC_STATIC
- Code:
- stack=2, locals=2, args_size=1
- 0: ldc #16 // String MahendraSinghDhoni --> This line
- 2: astore_1
- 3: getstatic #18 // Field java/lang/System.out:Ljav
- /io/PrintStream;
- 6: aload_1
- 7: invokevirtual #24 // Method java/io/PrintStream.prin
- ln:(Ljava/lang/String;)V
- 10: return
- String concatenation = "a" + "b" + "c";
- String concatenation = "abc";
- String a;
- String b;
- String c;
- String d;
- String e;
- // Initialization and use of a, b, c, d, e
- String concat = a + b + c + d + e;
- String a;
- String b;
- String c;
- String d;
- String e;
- // Initialization and use of a, b, c, d, e
- String concat = new StringBuilder(a).append(b).append(c).append(d).append(e).toString();
- String a;
- String b;
- String c;
- // Initialization and use of a, b, c
- String concat = a + b + c;
- String a;
- String b;
- String c;
- // Initialization and use of a, b, c
- String concat = a.concat(b).concat(c);
- public String concat(String str) {
- int otherLen = str.length();
- if (otherLen == 0) {
- return this;
- }
- char buf[] = new char[count + otherLen];
- getChars(0, count, buf, 0);
- str.getChars(0, otherLen, buf, count);
- return new String(0, count + otherLen, buf);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement