Maximum sub array sum

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t–)
{
int n=sc.nextInt();
int[] arr=new int[n];
for(i=0;i<n;i++){

		arr[i]=sc.nextInt();
	}
		int sum_arr[10000]=0;
		sum_arr=arr[0];
		for(int i=1;i<n;i++)
		sum_arr[i]=sum_arr[i-1]+arr[i];
		int sum=0,current_sum;
		for(int i=0;i<n;i++)
	{
		for(int j=i;j<n;j++)
		{
			current_sum=0;
			current_sum=(sum_arr[j]-sum_arr[i-1]);
			if(current_sum>sum)
			sum=current_sum;

		}
	}
	System.outprintln(sum);	
	
	}
}
}

i am getting error at int sum_arr[100000]=0;

@karthik1989photos,
While taking input you have not declared ‘i’.

Also, by default all values in the array are set to 0.

Also, you can fill all the indexes of an array using int sum_arr[10000]=0; This is an invalid syntax.
You can use Arrays.fill(arr_name, value_to_be_filled ); to fill all indexes with the same value.

Also there are other syntax mistakes.
Example: System.outprintln(sum); the . is missing after out

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.