forked from AndrewProgramming/JavaTutorialCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringStudy7.java
More file actions
53 lines (29 loc) · 916 Bytes
/
StringStudy7.java
File metadata and controls
53 lines (29 loc) · 916 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package objectandclass;
public class StringStudy7 {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder(55);
StringBuffer sb1 = new StringBuffer();
sb.append("Welcome");
sb.append(' ');
sb.append("to");
sb.append(' ');
sb.append("Java");
System.out.println(sb.toString());
sb.insert(11,"HTML and ");
System.out.println(sb.toString());
sb.delete(8,11);
System.out.println(sb.toString());
sb.deleteCharAt(8);
System.out.println(sb.toString());
sb.reverse();
System.out.println(sb.toString());
System.out.println(sb.capacity());
System.out.println(sb.length());
sb.append("11111111111111111111111111111111111");
System.out.println(sb.capacity());
System.out.println(sb.length());
sb.trimToSize();
System.out.println(sb.capacity());
System.out.println(sb.length());
}
}