Java2
Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ)
View Answers
October 3, 2012 at 6:14 PM
Here is an example that replaces the vowels of string with the z and reverse the string.
class StringExamples
{
public static void main(String[] args)
{
String st="John Smith";
String replaceString=st.replaceAll("[aeiou](?!\\b)", "z");
System.out.println(replaceString);
char ch[]=st.toCharArray();
String revstring="";
for(int i=ch.length-1;i>=0;i--){
revstring+=Character.toString(ch[i]);
}
System.out.println(revstring);
}
}
Ads
Related Tutorials/Questions & Answers:
Java2
Java2 Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ
Write a program that replaces a, e, i, o, u in Java2
Write a program that replaces a, e, i, o, u in
Java2 Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ
Advertisements
Java Programming Language
independence.
The
Java2 version was released in December 1998-1999. The new added... 1.2
8-Dec-1998
The Third release was
Java2
Standard Edition (J2SE), Its
J2EE Tutorial - Introduction
, such as '
Java2 -complete reference' by Schildt.,with
not a word anywhere... ..Distributed Objects') and Jaworsky ('
Java2
Unleashed') had