Problem in compilation

Please allow me to share screen shot.

getting error on 6,7 and 10 line

import java.util.*;
public class Main {

public static void main(String[] args) {
  int[] arr= {0,1,2,0,1,2};
	Linear_Sort(arr);
	display(arr);
}
public static int[] takeInput(){
	public static void display(int[] arr){
		public static void Linear_Sort(int[] arr){
			while (mid <= high)
			if (arr[mid]==0) {
			swap(arr[low],arr[mid]);
			low++ ; mid++ ;
			}
			else if(arr[mid]==1)
			mid++;
			else
			swap(arr[mid],arr[high]);
			high-- ;
		}
	}
}

}

@drn192000_6c12623796658f98 You have created a function inside a function which is not allowed. Look you have created a function named Linear_Sort inside the function takeInput this is not allowed in Java.(nesting of Function is not allowed)
Also you have to input from the user. DOnt hard code any array
Mistakes :
i) No. and positions of curly brackets is wrong at multiple places.
ii)You might have learn that if you sent to variables to a function and swap them the swaping doesn’t get done. The swapping can only be done in an array by providing the indexes you want to swap.
Corrected Code is below :

import java.util.*;

public class Main {

	public static void main(String[] args) {
		int[] arr = takeInput();
		Linear_Sort(arr);
		display(arr);
	}

	public static int[] takeInput() {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int arr[] = new int[n];

		for (int i = 0; i < n; i++) {

			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static void Linear_Sort(int[] arr) {
		int mid = 0;
		int low = 0;
		int high = arr.length - 1;
		while (mid <= high) {
			if (arr[mid] == 0) {
				swap(arr, low, mid);
				low++;
				mid++;
			} else if (arr[mid] == 1)
				mid++;
			else {
				swap(arr, mid, high);
				high--;
			}
		}
	}

	public static void display(int[] arr) {
		for (int element : arr) {
			System.out.println(element);
		}

		System.out.println();
	}

	public static void swap(int[] arr, int x, int y) {

		// Swapping should be simple like this
		int temp = arr[x];
		arr[x] = arr[y];
		arr[y] = temp;
	}
}

IT SHOWS ONE ERROR ON LINE 10

package Lecture1;
import java.util.Scanner;
public class Main {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args){
int n = sc.nextInt();
int[] arr= new int[n];
}
public static int[] takeInput(){
public static display(int[] arr) {
public static void Linear_Sort(int[] arr){
while (mid <= high)
if (arr[mid]==0) {
swap(arr[low],arr[mid]);
low++ ; mid++ ;
}
else if(arr[mid]==1)
mid++;
else
swap(arr[mid],arr[high]);
high-- ;
}
}

			for(int i=0; i< arr.length;i++) {
				System.out.println(arr[i]);
			}
		}

}

@drn192000_6c12623796658f98 I have already sent you the problems in your code and the corrected code also.

while (mid <= high) what is &lt

@drn192000_6c12623796658f98 I have no where mentioned &lt ?

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.