• java program to remove vowels from a string
  • To remove vowels from a string we can use predefined method of string  replaceAll()
  • By passing all vowels to the method replaceAll() with empty it will replaces all vowels with empty. 
  • Check below topic for more programs on string 
  • Java Experience interview programs on strings



 Program #1: Java example program to remove all vowels from a String



  1. package inheritanceInterviewPrograms;
  2. public class RemoveVowels {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com 
  6.      * @String interview programs asked in interviews
  7.      * @Remove vowels from a string in java
  8.      */
  9.  
  10.  public static void main(String[] args) {
  11.  
  12.         String str = "RemoveVowels";
  13.         String resustr = str.replaceAll("[aeiouAEIOU]", "");
  14.         System.out.println(resustr);
  15.  
  16.     }
  17.  
  18. }

 Output:


  1. RmvVwls

Program #2: Java example program to remove all vowels from a String by taking input from user


remove vowels from string

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu