Question: IN JAVA, Create a method called xChar that will replace a specified char in a String with the 'X' character. Your method must use a

IN JAVA,

Create a method called xChar that will replace a specified char in a String with the 'X' character. Your method must use a pointer to search and replace the char. Your method should take as arguments the String to search through and a char variable that holds the char to be searched for and replaced.

The method should return a String that has been modified.

Note:

Strings in Java are immutable. This means they cannot be changed. For this question simply copy all characters to a new string replacing the character to search for with the 'X' character.

Example Run:

Enter some text Hello World

Enter a character to x o

Here is your output Hellx Wxrd

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!