public static void main(String args[]){
String s1="my name is khan my name is java";
String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
}}
String str1 = "abc123abc123";
String str2 = str1.replace("abc", "0");
System.out.println(str2); // 01230123
String s1 = "my name is khan and my name is java";
String replaceString = s1.replace("is","was");
//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
String a = "Cool";
a = a.replace("o","yy");
public static void main(String args[]){
String s1="my name is khan my name is java";
String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
}}
Code Example |
---|
Java :: processing pi |
Java :: double number java |
Java :: get field name java |
Java :: How to change integers into float in java |
Java :: Java telegram bot dependency |
Java :: increment an array java |
Java :: Java Creating an EnumMap |
Java :: java static keyword |
Java :: java record |
Java :: Java Remove Elements from HashSet |
Java :: getter in java |
Java :: json java |
Java :: maths trivia in java |
Java :: java stream findany |
Java :: Java Expression statements |
Java :: java convert char to charsequence |
Java :: switch statement in java |
Java :: hashmap java |
Java :: run specific test case junit |
Java :: private access modifiers |
Java :: logcat android |
Java :: string cannot be resolved to a type eclipse |
Java :: method overriding java |
Java :: Java How to use NavigableMap? |
Java :: netbens setdefaultbutton |
Java :: empty map entry java |
Java :: javax.net.ssl.trustStore trustall |
Java :: java bitwise xor |
Java :: zoom sdk not initialized |
Java :: taking user input in array in java using constructor |