java - The method replace(char, char) is undefined for the type Scanner

1k views Asked by At

This is my code: https://gyazo.com/8bf55245851665b91d482859b6413a75

I want to replace the first letter of the first word with the first letter of the second word but the replace tool won't work?

1

There are 1 answers

4
Java Rookie On

In your code there is no String sc That you have used in the line for replacing the character. Use this line instead;

String replace1=fword1.replace(flfw,flsw);

I am referring to line 27 of your code.

And you don't require those for loops there.

Thank You.