/* Write a java program in java to reverse each word of string like this
input:-"Altaf Java Blog"
output:-"Blog Java Altaf"
*/
class ReverseString3
{
public static void main(String[] alt)
{
String s="Altaf Java Blog";
String[] s2=s.split(" ");
String s3=new String();
for(int i=s2.length-1;i>=0;i--)
{
s3=s3.concat(s2[i]+" ");
}
System.out.println(s3);
}
}
input:-"Altaf Java Blog"
output:-"Blog Java Altaf"
*/
class ReverseString3
{
public static void main(String[] alt)
{
String s="Altaf Java Blog";
String[] s2=s.split(" ");
String s3=new String();
for(int i=s2.length-1;i>=0;i--)
{
s3=s3.concat(s2[i]+" ");
}
System.out.println(s3);
}
}
0 Comment to "Write a java program in java to reverse each word of string like this input:-"Altaf Java Blog" output:-"Blog Java Altaf""
Post a Comment