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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started