I have a method that is SUPPOSE to prompt the user to enter the name of the item to search for. If it exist then say it was found and return the index number. if it doesn't then tell them it doesn't.
I am not allowed to use Arraylist either.
I honestly don't know where to start...
If I run this it gives me my else print statement in a loop until exit condition is satisfied.
public static void searchList( String[] list, int currentSize){ String item; System.out.println("Enter the item you want to search for: "); item = in.nextLine(); for (int n=0; n < list.length; n++) if(list[n] != null && list[n].equals(item)) System.out.println ("The item was found, and the index of the array element is" + n); else System.out.println ("The item you enter does not exist in the list"); }