Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package removestring;
- import java.util.Scanner;
- public class RemoveString {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String sentence, str;
- System.out.print("Enter a sentence:");
- sentence = input.nextLine();
- System.out.print("Enter a string:");
- str = input.nextLine();
- input.close();
- sentence = sentence.replaceAll(str,"");
- System.out.print(sentence);
- }
- }
Add Comment
Please, Sign In to add comment