What is wrong in this code?

package arrays;

import java.util.Scanner;

public class UPPERBOUNDANDLOWERBOUND {

public static void main(String[] args) {
	Scanner scn=new Scanner(System.in);
	int n= scn.nextInt();
	int [] arr =new int[n];
	for (int i=0;i<n;i++) {
		arr[i]=scn.nextInt();
	}
	int Q=scn.nextInt();
	int data;
	for (int i=0;i<Q;i++) {
	
		data=scn.nextInt();
	}
		System.out.println(lowerbound(arr,data));
		System.out.println(upperbound(arr,data));
	
	
	
}
public static int upperbound(int [] arr, int data) {
	int low=0,high=arr.length-1;
	int ans=-1;
	while(low<=high) {
		int mid=(low+high)/2;
		if (arr[mid]==data) {
			ans=mid;
			low=mid+1;
			
		}
		else if (data<arr[mid]) {
			high=mid-1;
			
		}
		else {
			low=mid+1;
		}
	}
	return ans;
}
public static int lowerbound(int [] arr, int data) {
	int low=0,high=arr.length-1;
	int ans=-1;
	while(low<=high) {
		int mid=(low+high)/2;
		if (arr[mid]==data) {
			ans=mid;
			high=mid+1;
			
		}
		else if (data<arr[mid]) {
			high=mid-1;
			
		}
		else {
			low=mid+1;
		}
	}
	return ans;
}

}

Hey @harsh.hj
There are 2 changes in your code
Fist
Inside the Main function
for (int i = 0; i < Q; i++) {

		data = scn.nextInt();
	// Mera change in side the loop fun call hoga  
	System.out.print(lowerbound(arr, data)+" ");
	System.out.println(upperbound(arr, data));
	}

Second
in lowerbound fun
// high = mid+ 1; mid -1 hoga
high = mid -1;
correct code

thanks sir plz tell the remaining doubts also plz

@harsh.hj
Please mark your doubts as resolved in your course’s.
Okay I see it