Java tutorial
import java.util.Scanner; public class Main { public static void rotate(char[][] original) { char[][] rotated = new char[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { rotated[i][j] = original[j][i]; } System.out.println("\n"); } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { System.out.print(rotated[i][j]); } System.out.println("\n"); } } public static void main(String[] args) { char[][] original = new char[3][3]; Scanner s = new Scanner(System.in); System.out.println("Enter values: "); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { original[i][j] = s.next().charAt(0); } } rotate(original); } }