Help me with the code to get output!

package week3; 
import java.util.Scanner;
import java.util.ArrayList;
 
public class Refferal_candidate { 
 static int n,x,a[]; 
 static boolean Search() 
 { 
 for(int i=0;i<n;i++) 
   {if(x==a[i]) 
    return true; 
   } 
 return false; 
 } 
  
 public static void main(String[] args) { 
  Scanner s=new Scanner(System.in); 
  System.out.println("Enter no. of candidates"); 
  n=Integer.parseInt(args[0]); 
  a = new int[n];   
  System.out.println("Enter ids of candidates"); 
  for(int i=0;i<n;i++) 
    {a[i]=Integer.parseInt(args[i+1]);} 
  System.out.println("Enter id of referral candidate"); 
  x=s.nextInt(); 
  Refferal_candidate p=new Refferal_candidate(); 
  boolean y=Search(); 
  if(y) 
   System.out.println("Found"); 
  else 
   System.out.println("Not found"); 
 } 
 
}

Hello there.

Do you have a question?

If so, please edit your post to include it.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.