Language: Java



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;

/**
 * <pre>
 * ??????????????????
 * </pre>
 *
 * @author ?????????????????§???
 * @version 1.8_45
 * @since 1.8_45
 */
public class main {

	public static void main(String[] args) throws IOException {

		// ?????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		// 1?????????????????????????????????????§????????????????????????°
		int data_set = Integer.parseInt(br.readLine());
		// ??\?????????????????????????????????????????£?¨?
		String tmp_row;

		while ((tmp_row = br.readLine()) != null && !tmp_row.isEmpty()) {
			String[] tmp_line = tmp_row.split(" ");
			// ??????????????????
			int map_height = Integer.parseInt(tmp_line[0]);
			// ???????????????
			int map_width = Integer.parseInt(tmp_line[1]);
			// ????????¨???????????£?????????????????????
			char[][] game_Map = new char[map_height + 2][map_width + 2];
			// ?????????????????????????????±???????´???´???
			Tank tank = null;

			// ??°????????????????£?????????????
			for (int wall = 0; wall < map_height + 2; wall++) {
				Arrays.fill(game_Map[wall], 'W');
			}

			// ????????????????????°??¢?????\????????????
			for (int mh = 1; mh < map_height + 1; mh++) {
				tmp_row = br.readLine();
				for (int mw = 0; mw < map_width; mw++) {
					// ??°??????????£?
					game_Map[mh][mw + 1] = tmp_row.charAt(mw);

					// ????????????????????±????????????????´?
					// ???????????????????????°????????????
					if ("^v<>".indexOf(game_Map[mh][mw + 1]) > -1) {
						// init tank.
						tank = new Tank(game_Map, game_Map[mh][mw + 1], new int[] { mh, mw + 1 });
						game_Map[mh][mw + 1] = '.';
					}
				}
			}
			br.readLine();
			// ?????????????????????
			tmp_row = br.readLine();
			for (char cmd : tmp_row.toCharArray())
				tank.command(cmd);

			// ????????????????????????????????±?????¨?¨???????
			tank.last_tankLocate();
			data_set--;

			// ??°??¢?????????
			// ???????????????????????°????????????
			for (int ch = 1; ch < map_height + 1; ch++) {
				for (int cw = 1; cw < map_width + 1; cw++) {
					System.out.print(game_Map[ch][cw]);
				}
				System.out.println();
			}
			if (data_set > 0)
				System.out.println();
		} // while?????????????????????
	}// ?????????????????????????????????

}// ???????????????????????????????????????

class Tank {

	/**
	 * ?????????
	 */
	private char[][] map;

	/**
	 * ??????????????¨??°
	 */
	private int[] pos;
	/**
	 * ??????
	 */
	private char dir;

	/*
	 * ????????????????????????
	 */
	Tank(char[][] map, char dir, int[] pos) {
		this.dir = dir;
		this.map = map;
		this.pos = pos;
	}

	/*
	 * ?§??????????
	 */
	HashMap<Character, Character> move_Cmd = new HashMap<Character, Character>() {
		{
			put('U', '^');
			put('D', 'v');
			put('L', '<');
			put('R', '>');
		}
	};

	/*
	 * ?§??????¢???
	 */
	HashMap<Character, int[]> move_Dir = new HashMap<Character, int[]>() {
		{
			put('^', new int[] { -1, 0 });
			put('v', new int[] { 1, 0 });
			put('<', new int[] { 0, -1 });
			put('>', new int[] { 0, 1 });
		}
	};

	// ???????????????????????°????????????
	void command(char cmd) {

		if (cmd != 'S') {
			move_tank(cmd);
		} else {
			cannon_Shot();
		}
	}

	/**
	 * <pre>
	 * ?????????????????????
	 * ????????¬?????¬????£??????¶????????£???????????°?????????
	 * ?????????????£??????°?????????
	 * ????????°??????????????¨??§?????£????????????????¶????
	 * </pre>
	 *
	 * @param shell
	 *            ??????
	 */
	private void cannon_Shot() {
		int[] shell = new int[] { this.pos[0], this.pos[1] };
		while (true) {
			shell[0] += move_Dir.get(this.dir)[0];
			shell[1] += move_Dir.get(this.dir)[1];
			switch (map[shell[0]][shell[1]]) {
			case '.':
			case '-':
				continue;
			case '*':
				map[shell[0]][shell[1]] = '.';
			case '#':
			case 'x':
			}
			break;
		}

	}// cannon_Shoot????????????????????????

	/**
	 * <pre>
	 *?????????????§????
	 *
	 *???????????°???????§??????????
	 *???????????¬??????????????????????????£????§???????????????¨?????????
	 * </pre>
	 *
	 * @param cmd
	 *            ?????¬??????????????????
	 * @param move
	 *            ??????????§????
	 */
	private void move_tank(char cmd) {

		this.dir = move_Cmd.get(cmd);
		int[] next = new int[] { this.pos[0], this.pos[1] };
		next[0] += move_Dir.get(this.dir)[0];
		next[1] += move_Dir.get(this.dir)[1];
		if (map[next[0]][next[1]] == '.') {
			this.pos[0] = next[0];
			this.pos[1] = next[1];
		}
	}// move_tank????????????????????????

	void last_tankLocate() {
		// ?????????????????¨??°?????°????????¨?¨???????
		map[this.pos[0]][this.pos[1]] = this.dir;
	}

}// Tank?????????????????????

Compiler output:
Main.java:18: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error