If you specify a specific word for the source
I'm going to read the sentence after that word
What should I do?
For example,
I want to go home. If there's a sentence that says, "Do you want to go home?" If I write a specific word in the source and execute it,
I want to go home.
Do you want to go home?
To make it look like this.
What should I do?
java
Use the replace method in string. Example)
class CodeRunner{
public static void main(String[] args){
String1 = "I want to go home. Do you want to go home? I want to go to the company. Do you want to go to the company?";
String 2 = s1.replace ("Da"), "Da".\n");
System.out.println(s2);
}
}
© 2024 OneMinuteCode. All rights reserved.