Is this code Right?

import java.util.*;
public class Main {
// Online Java Compiler
// Use this editor to write, compile and run your Java code online

static Scanner sc = new Scanner(System.in);
public static void main(String args[]) {
    int[] ar = {6,8,1,1,8,3,4};
    System.out.println(funct(ar,0,8));
      }
      
      public static int funct(int n[],int st,int data){
          int val = -1;
         if(n.length-1<st)
            return val;
         
         if(n.length-1>=st){
           val = funct(n,st+1,data);
           if(n[st]==data && val == -1)
             val=st;
         }
           return val;
          
          }

}

Hi @uttamjaish
Please share your code using codingblocks ide so that i can easily debug and run your code and also provide me the question statement.

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.

I think the code is right and perfect because I run and compile it in visual code and I love to see it error free I hope I get more code like this thank you
PrepaidGiftBalance