-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString_Types_Buffer.java
More file actions
38 lines (18 loc) · 860 Bytes
/
String_Types_Buffer.java
File metadata and controls
38 lines (18 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.mywork;
public class String_Types_Buffer {
public static void main(String[] args) {//string buffer is a class
StringBuffer b = new StringBuffer("Java");
System.out.println(System.identityHashCode(b));//885284298
//identify the memory location stored
StringBuffer a = new StringBuffer("Java");
System.out.println(System.identityHashCode(a));//1389133897
//identify the memory location is stored as new
StringBuffer append = a.append("Language");
System.out.println(append);// in buffer we can append the two strings
//JavaLanguage
System.out.println(System.identityHashCode(append));
//in buffer memory will be shared while doing append
System.out.println(a);// in buffer string is mutable --mutable mean the value can be changed
System.out.println(b);
}
}