exception showing in java code......at statement----- if(a[j]>a[j+1])..... please help please help
package arrays; import java.util.Scanner; public class array { public static void main(String[] args){ int n; System.out.println("enter n"); Scanner myvar=new Scanner(System.in); n=myvar.nextInt(); int arr[]= new int[n]; for(int i=0;i<arr.length;i++) arr[i]=myvar.nextInt(); System.out.println("\n your array is ..."); for(int t:arr) System.out.println("\n "+t); System.out.println(arr[1+1]); for(int i=0;i<(arr.length)-1;i++) {for(int j=0;j<arr.length;j++) { if(arr[j]>arr[j+1]) { arr[j]=arr[j]+arr[j+1]; arr[j+1]=arr[j]-arr[j+1]; arr[j]=arr[j]-arr[j+1]; } } } System.out.println("\n your sorted array is ..."); for(int t:arr) System.out.println("\n "+t); } }