String str = "Welcome to plus2net.com";
System.out.println(str.replaceFirst("o","*"));
Output is here
Welc*me to plus2net.com
Replacing string
String str = "Welcome to plus2net.com";
System.out.println(str.replaceFirst("com","net"));
Output is here
Welnete to plus2net.com
Note : In above code, there is one replacement.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.