If you want your string to covert from Immutable to Mutable then better solution is :
Convert the String to CharArray :
package com.techyield.operationsinarray;
public class StringCharArray {
public static void main(String[] args) {
String s1 ="Sunny G";
char[] array = s1.toCharArray();
array[5] = ',';
System.out.println(array);
}
}
No comments:
Post a Comment