- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringb.java
More file actions
Latest commit
26 lines (23 loc) · 732 Bytes
/
Copy pathstringb.java
File metadata and controls
26 lines (23 loc) · 732 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
publicclassstringb {
publicstaticvoidmain(Stringargs[]){
StringBuildersb=newStringBuilder("mrinal");//create string using string builder
System.out.println(sb);
System.out.println(sb.charAt(0));
//replace charachter
sb.setCharAt(0,'p');
//insert at start
System.out.println(sb);
sb.insert(0,'S');
System.out.println(sb);
//delete charachter
sb.delete(0,1);
System.out.println(sb);
//append at end
sb.append("more");
System.out.println(sb);
//length
System.out.println(sb.length());
sb.setCharAt(0,'m');
System.out.println(sb);
}
}