Sir Can you help me my code is giving error

import java.util.Scanner;

public class BuildBSTQue {
public class Node{
int data;
Node left;
Node right;
}
private Node root;
public BuildBSTQue(int[] arr) {
this.root=construct(arr,0,arr.length-1);
}

private Node construct(int[] arr, int lo, int hi) {
	if(lo>hi) {
		return null;
	}
	int mid=(lo+hi)/2;
	Node nn=new Node();
	nn.data=arr[mid];
	nn.left=construct(arr,lo,mid-1);
	nn.right=construct(arr,mid+1,hi);
	return nn;
}
public void preOrder() {
	this.preOrder(this.root);
}
private void preOrder(Node node) {
	if(node==null) {
		return;
	}
	System.out.print(node.data+" ");
	preOrder(node.left);
	preOrder(node.right);
}

public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int test = s.nextInt();
	while(test>0) {
		int length = s.nextInt();
		int [] myArray = new int[length];
		 for(int i=0; i<length; i++ ) {
	         myArray[i] = s.nextInt();
	      }
		BuildBSTQue bst=new BuildBSTQue(myArray);
		bst.preOrder();
	test--;
	}
	
}

}

@karamjitverma89
your code is running just fine

import java.util.Scanner;

public class BuildBSTQue {
public class Node{
int data;
Node left;
Node right;
Node(int d){
this.data=d;
left=null;
right=null;
}
}
private Node root;
public BuildBSTQue(int[] arr) {
this.root=construct(arr,0,arr.length-1);
}

private Node construct(int[] arr, int lo, int hi) {
if(lo>hi) {
return null;
}
int mid=(lo+hi)/2;
Node nn=new Node(arr[mid]);

nn.left=construct(arr,lo,mid-1);
nn.right=construct(arr,mid+1,hi);
return nn;

}
public void preOrder() {
this.preOrder(this.root);
}
private void preOrder(Node node) {
if(node==null) {
return;
}
System.out.print(node.data+" ");
preOrder(node.left);
preOrder(node.right);
}

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int test = s.nextInt();
while(test>0) {
int length = s.nextInt();
int [] myArray = new int[length];
for(int i=0; i<length; i++ ) {
myArray[i] = s.nextInt();
}
BuildBSTQue bst=new BuildBSTQue(myArray);
bst.preOrder();
test–;
}

}
}

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.