问题:
package com.example.demo; public class Test344 { public void reverseString(char[] s) { // 双指针 int left = 0; int right = s.length - 1; while (left < right) { char temp = s[left]; s[left] = s[right]; s[right] = temp; left++; right--; } } public static void main(String[] args) { Test344 t = new Test344(); char[] arr = {'a', 'b', 'c'}; t.reverseString(arr); for (char c : arr) { System.out.println(c); } } }