Can anyone correct my code .if input = Wow i got this output should be this got i Wow but with only 1 space in between | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone correct my code .if input = Wow i got this output should be this got i Wow but with only 1 space in between

public class Program { public static void main(String[] args) { String a ="Wow i got this"; String [] arr = a.split(" "); String w =""; int x =arr.length; for(int i=x-1;i>=0;--i){ String z = arr[i]; } String e= z.trim(); System.out.print(e); } }

13th May 2020, 5:08 AM
Shivam Rawal
1 Answer
0
Tysm
13th May 2020, 6:00 AM
Shivam Rawal