KeeganT

Ch6Ex19

Feb 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package ch6ex19;
  2. import java.util.Scanner;
  3.  
  4. public class Ch6Ex19
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner sc=new Scanner(System.in);
  9.         System.out.print("Enter a sentence: ");
  10.         String str=sc.nextLine();
  11.         System.out.print("Enter a string to remove: ");
  12.         String substr=sc.nextLine();
  13.         String newStr=str.replace(substr,"");
  14.         System.out.println(newStr);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment