String Immutable to Mutable (Java) Solutions



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

Featured Post

H1B Visa Stamping at US Consulate

  H1B Visa Stamping at US Consulate If you are outside of the US, you need to apply for US Visa at a US Consulate or a US Embassy and get H1...