Language: Java

t H,W;
		Scanner sc = new Scanner(System.in);
		while(true){
			H = sc.nextInt();
			W = sc.nextInt();
			if(H == 0 || W == 0){
				break;
			}
			char [][] array = new char[H][W];
			sc.nextLine();
			for(int i = 0; i < H; i++){
				String line = sc.nextLine();
				for(int j = 0; j < W; j++){
					array[i][j] = line.charAt(j);
				}
			}
			int i = 0;
			int j = 0;
			boolean flag = true;
			boolean visit[][] = new boolean[H][W];
			here:while(flag){
				if(visit[i][j]){
					System.out.println("LOOP");
					break here;
				}
				visit[i][j] = true;
				switch(array[i][j]){
				case '>':
					j++;
					break;
				case '<':
					j--;
					break;
				case '^':
					i--;
					break;
				case 'v':
					i++;
					break;
				case '.':
					System.out.println(j+" "+i);
					break here;
				}
			}
		}
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
t H,W;
^
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
		Scanner sc = new Scanner(System.in);
		^
  (use --enable-preview to enable unnamed classes)
Main.java:3: error: class, interface, enum, or record expected
		while(true){
		^
Main.java:5: error: class, interface, enum, or record expected
			W = sc.nextInt();
			^
Main.java:6: error: class, interface, enum, or record expected
			if(H == 0 || W == 0){
			^
Main.java:8: error: class, interface, enum, or record expected
			}
			^
Main.java:10: error: class, interface, enum, or record expected
			sc.nextLine();
			^
Main.java:11: error: class, interface, enum, or record expected
			for(int i = 0; i < H; i++){
			^
Main.java:11: error: class, interface, enum, or record expected
			for(int i = 0; i < H; i++){
			               ^
Main.java:11: error: class, interface, enum, or record expected
			for(int i = 0; i < H; i++){
			                      ^
Main.java:13: error: class, interface, enum, or record expected
				for(int j = 0; j < W; j++){
				^
Main.java:13: error: class, interface, enum, or record expected
				for(int j = 0; j < W; j++){
				               ^
Main.java:13: error: class, interface, enum, or record expected
				for(int j = 0; j < W; j++){
				                      ^
Main.java:15: error: class, interface, enum, or record expected
				}
				^
Main.java:20: error: class, interface, enum, or record expected
			boolean visit[][] = new boolean[H][W];
			^
Main.java:21: error: class, interface, enum, or record expected
			here:while(flag){
			^
Main.java:24: error: class, interface, enum, or record expected
					break here;
					^
Main.java:25: error: class, interface, enum, or record expected
				}
				^
Main.java:27: error: class, interface, enum, or record expected
				switch(array[i][j]){
				^
Main.java:30: error: class, interface, enum, or record expected
					break;
					^
Main.java:31: error: class, interface, enum, or record expected
				case '<':
				^
Main.java:33: error: class, interface, enum, or record expected
					break;
					^
Main.java:34: error: class, interface, enum, or record expected
				case '^':
				^
Main.java:36: error: class, interface, enum, or record expected
					break;
					^
Main.java:37: error: class, interface, enum, or record expected
				case 'v':
				^
Main.java:39: error: class, interface, enum, or record expected
					break;
					^
Main.java:40: error: class, interface, enum, or record expected
				case '.':
				^
Main.java:42: error: class, interface, enum, or record expected
					break here;
					^
Main.java:43: error: class, interface, enum, or record expected
				}
				^
29 errors