Question: 2. There is something called a Java String replaceAll() method that returns a String after it replaces each substring of that matched the given regular

 2. There is something called a Java String replaceAll() method that

2. There is something called a Java String replaceAll() method that returns a String after it replaces each substring of that matched the given regular expression with the given replacement. The general form is StringName. replaceAll (String regrex, String replacement) Create a new project to test this method running the following lines of code. Write down the output of your program String str1 - "This is a test to see what is going to happen." System.out.println(stri); System.out.println(str1.replaceAll("18", "at"); Now, write a program that asks for three strings as input. The program should then replace all occurrences of the second input with the third input in the first input. For example, when you run your program, it would look like Input string #1: This is a longer string as an example of replacement. Input string 2 Taput string #31 ort Thin in a loortger striertg an aert example of replacemoartt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!