
import java.util.*; class StringExample6 { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Enter string:"); String str=input.nextLine(); StringTokenizer stk=new StringTokenizer(str); String vowels="",consonants=""; while(stk.hasMoreTokens()){ String token=stk.nextToken(); if(token.startsWith("a")||token.startsWith("e")||token.startsWith("i")||token.startsWith("o")||token.startsWith("u")){ vowels+=token+" "; } else if(!token.startsWith("a")||!token.startsWith("e")||!token.startsWith("i")||!token.startsWith("o")||!token.startsWith("u")){ consonants+=token+" "; } } System.out.println("Second Output: "+vowels.concat(consonants)); } }
above a program code of reverse string program in this program user input a string and print all vowel worts at start and end all consonant. i've a problem that plz describe me full description of this code thanks

In the above code, we have used StringTokenizer class that splits the string on the basis of " ".The method hasMoreTokens() of this class searches the words or tokens till the end of the string. The method nextToken() finds the word. If that word or token starts with a or e or i or o or u, then the word will store into the string vowels, otherwise the words will get stored into the string consonants. At last we have concatenated both the strings.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.