공부
[java] reverse string
승가비
2022. 9. 11. 19:02
728x90
public class ReverseString {
public static void main(String[] args) {
String str = "abcde";
StringBuffer sb = new StringBuffer(str);
String reversedStr = sb.reverse().toString();
System.out.println(reversedStr); // edcba
}
}
출처: https://yangbox.tistory.com/59 [양's World:티스토리]
728x90