Write a Java Program to Delete or Remove Words from String without Function

By | March 9, 2017

Java Program to Delete or Remove Words


Write a Java Program to Delete or Remove Words from String without using Inbuilt Function. For delete any particular word from the string  in Java Programming, first, you have to ask to the user to enter the string,then second ask to enter the any word present in the string to delete that word from the string.

After asking the two, now check for the presence of that word and perform the deletion of that word from the sentence as shown in the following program.

Example –

Input– This is the sample input from the user.
Word to be deleted– the
Output– This is sample input from user.

Since, We have two methods to delete vowels from the string : –

First method that we already discussed in the previous post that is to Program to Remove or Delete words using Inbuilt Function .

Second method is shortcut method that uses the manual method to replace all the words from the string and display the screen on the screen

Following Java Program ask to the user to enter a string, then ask to enter a word to be delete from the string, then display the new string after deleting the given word.

Here is source code of the Java Program to remove given word from a string. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.


SOURCE CODE : :



OUTPUT : :


Leave a Reply