I'm a beginner at Java, and I have created two text files. Lets say txt1 says ("Hello, blank") and the other txt2 file has the name ("John").
我是Java的初学者,我创建了两个文本文件。让我们说txt1说(“你好,空白”)而另一个txt2文件有名字(“John”)。
How do I go about using Scanner to read txt1, then replace the word "blank" with the name "John" from txt2? or is do I not need scanner?
如何使用Scanner读取txt1,然后从txt2替换名为“John”的单词“blank”?或者我不需要扫描仪吗?
1 个解决方案
#1
1
Just read the files to a String and use the replace function
只需将文件读取为String并使用replace函数即可
public String replace(char oldChar, char newChar)
But please read the how to ask page.
但请阅读如何询问页面。
#1
1
Just read the files to a String and use the replace function
只需将文件读取为String并使用replace函数即可
public String replace(char oldChar, char newChar)
But please read the how to ask page.
但请阅读如何询问页面。