Please resolve the error showing "could not find or load main"

here the code import java.util.*;
class binary
{
public static void main(String args[])
{
int size,i,key,first=0,last,mid;
Scanner scan=new Scanner(System.in);
size=scan.nextInt();
int arr[]=new int[size];
if(size>=0)
{
for(i=0;i<size;i++)
{
if(arr[i]>=-1000000000&&arr[i]<=1000000000)
arr[i]=scan.nextInt();

   } 
   key=scan.nextInt();
   last=size-1; 
   mid=(first+last)/2;  

while(first<=last)
{
if(arr[mid]<key)
{
first=mid+1;
}
else if(arr[mid]==key)
{
System.out.println(mid);
break;
}
else
{
last=mid-1;
}
mid=(first+last)/2;
}
if(first>last)
{
System.out.println(-1);
}
}
}
}

@mohdkaifalam041,
https://ide.codingblocks.com/s/231702 here is your corrected code. Try to submit this. Your code is correct just make the class public.

Also, if it still shows the error, kindly drop an email to [email protected] for help.

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.