Language: Java

import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();//マス目の設定
        int W = sc.nextInt();
        String[][] map;
      	map=new String [H][W];
      	result=new int[H][W];
       	
      
      	for(int i=0;i<H;i++) {//データの打ち込み
          for(int j=0;j<W;j++){
			map[i][j]=sc.next();
          }
		}
     	for(int i=0;i<H;i++) {//データの打ち込み
          for(int j=0;j<W;j++){
			result[i][j]=-1;
          }
		}
      
      	for(int i=0;i<H;i++) {//変換
          for(int j=0;j<W;j++){
           	if(map[i][j]=="."){
              result[H][W]="0";
              
              if(map[i][j+1]=="#"){
				result[i][j]+=1;
              }
              if(map[i][j-1]=="#"){
				result[i][j]+=1;
              }
              if(map[i+1][j]=="#"){
				result[i][j]+=1;
              }
              if(map[i-1][j]=="#"){
				result[i][j]+=1;
              }
              if(map[i+1][j+1]=="#"){
				result[i][j]+=1;
              }
              if(map[i-1][j+1]=="#"){
				result[i][j]+=1;
              }
              if(map[i+1][j-1]=="#"){
				result[i][j]+=1;
              }
              if(map[i-1][j-1]=="#"){
				result[i][j]+=1;
              }
              
           	}
          }
		}
      
      
      for(int i=0;i<H;i++) {//データの書き出し
        for(int j=0;j<W-1;j++){
          if(result[i][j]==-1){
			System.out.print(map[i][j]);
          }else{
          	System.out.print(result[i][j]);
          }
        }
      }  
		if(result[i][W]==-1){
		  System.out.println(map[i][W]);
        }else{
          System.out.println(result[i][W]);
        } 
        
	  
      
    }
}


Compiler output:
Main.java:11: error: cannot find symbol
      	result=new int[H][W];
      	^
  symbol:   variable result
  location: class Main
Main.java:21: error: cannot find symbol
			result[i][j]=-1;
			^
  symbol:   variable result
  location: class Main
Main.java:28: error: cannot find symbol
              result[H][W]="0";
              ^
  symbol:   variable result
  location: class Main
Main.java:31: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:34: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:37: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:40: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:43: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:46: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:49: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:52: error: cannot find symbol
				result[i][j]+=1;
				^
  symbol:   variable result
  location: class Main
Main.java:62: error: cannot find symbol
          if(result[i][j]==-1){
             ^
  symbol:   variable result
  location: class Main
Main.java:65: error: cannot find symbol
          	System.out.print(result[i][j]);
          	                 ^
  symbol:   variable result
  location: class Main
Main.java:69: error: cannot find symbol
		if(result[i][W]==-1){
		   ^
  symbol:   variable result
  location: class Main
Main.java:69: error: cannot find symbol
		if(result[i][W]==-1){
		          ^
  symbol:   variable i
  location: class Main
Main.java:70: error: cannot find symbol
		  System.out.println(map[i][W]);
		                         ^
  symbol:   variable i
  location: class Main
Main.java:72: error: cannot find symbol
          System.out.println(result[i][W]);
                             ^
  symbol:   variable result
  location: class Main
Main.java:72: error: cannot find symbol
          System.out.println(result[i][W]);
                                    ^
  symbol:   variable i
  location: class Main
18 errors