Language: Java

import java.util.Scanner;
import java.util.*;
public class Main {
	
	
	
	public static long KnapsackM(long weight[] , long value[] ,long mw,long n) {
		long dp[][] = new long[n+1][mw+1];
		
		for(long i=0;i<=n;i++) {
			for(long w=0;w<=mw;w++) {
				if(i==0 || w==0) {
					dp[i][w] = 0;
				}else if(weight[i-1] <= w) {
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
				}else {
					dp[i][w] = dp[i-1][w];
				}
			}
		}
		
		return dp[n][mw];
		
	}
	
	
	  
	
	
    public static void main(String[] arg) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong();
        long mw = s.nextLong();
        long weight[] = new long[n];
        long value[] = new long[n];
        for(long i=0;i<n;i++) {
        	long wi = s.nextLong();
        	long vi = s.nextLong();
        	weight[i] = wi;
        	value[i] = vi;
        }
        System.out.println(KnapsackM(weight,value,mw,n));
//        System.out.println(knapSack(mw,weight,value,n));
    }
}

Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		long dp[][] = new long[n+1][mw+1];
		                        ^
Main.java:8: error: incompatible types: possible lossy conversion from long to int
		long dp[][] = new long[n+1][mw+1];
		                              ^
Main.java:13: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = 0;
					   ^
Main.java:13: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = 0;
					      ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
				}else if(weight[i-1] <= w) {
				                 ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					   ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					      ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                           ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                                     ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                                                   ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                                          ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                                                              ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = Math.max(value[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]);
					                                                                  ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = dp[i-1][w];
					   ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = dp[i-1][w];
					      ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = dp[i-1][w];
					               ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
					dp[i][w] = dp[i-1][w];
					                   ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
		return dp[n][mw];
		          ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
		return dp[n][mw];
		             ^
Main.java:34: error: incompatible types: possible lossy conversion from long to int
        long weight[] = new long[n];
                                 ^
Main.java:35: error: incompatible types: possible lossy conversion from long to int
        long value[] = new long[n];
                                ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
        	weight[i] = wi;
        	       ^
Main.java:40: error: incompatible types: possible lossy conversion from long to int
        	value[i] = vi;
        	      ^
23 errors