Spotify Interview Question

Reverse a string, reverse only words of a string, inline implementation of reverse words in a string?

Interview Answer

Anonymous

Dec 12, 2018

public class StringReverse { public static void main(String[] args){ String string="Hello World"; StringBuffer sb= new StringBuffer(string); sb.reverse(); System.out.println(sb); } }

2