Here it is:
the user enters string and then then they enter a word from the sentnce they just entered in. then the program is supposed to take out the word they entered and then display the new sentence..

How to do this ????????
really need help PLEASE... :(

this is what i have so far...

import java.util.Scanner;
public class RemoveString {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input=new Scanner(;   

        String sent;
        String string;
        String part;

        System.out.println("Enter a sentence:");
        System.out.println("Enter a string:");


This case can have 2 cases.
1) Delete all the occurence of given word
2)Delete only a given occurence(mostly first) of given word

You have to split the input sentence using String.split() method. It will result into a array of Sring, containing all your words. Now compare all your words with the given input word. If a match is not there append the word into a StringBuilder along with a space. This will remove all the occuerence. If you want to delete a particular instance. Count the no of instance and break from the loop accordingly