Advertisement
JordanFarnell

Example 19

Oct 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package example19;
  2.  
  3. /*
  4.  * @author Froge
  5.  */
  6.  
  7. import java.util.Scanner;
  8. import java.lang.String;
  9.  
  10. public class Example19 {
  11.  
  12.    public static void main(String [] args) {
  13.         String sentence, wordTakenOut, newSentence;
  14.             Scanner input = new Scanner(System.in);
  15.             System.out.print("Enter a sentence: ");
  16.             sentence = input.nextLine();
  17.             System.out.print("Enter a string: ");
  18.             wordTakenOut = input.nextLine();
  19.             input.close();
  20.             newSentence = sentence.replace(wordTakenOut + " ","");
  21.    }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement