0
Plzz solve my error
2 Antworten
+ 5
Or else
Use string class instead of string buffer, if you may trying this way:
public class Program
{
public static void main(String[] args) {
String sb=new String("hello");
System.out.println(sb.replace('h','r'));
System.out.println(sb); // original string won't change.. try to check
}
}
+ 3
Kajal Kumari
replace method have 3 parameters
1 - start index int type
2 - end index int type
3 - a string not character
System.out.println(sb.replace(0, 1, "r"));