hi! I'm currently studying and having difficulty being able to print the array list, im not sure where im going wrong. any help will be appreciated

import java.util.*;
public class practice
{
    static Scanner sc = new Scanner (System.in);
    static int numberOfCoffees = 0;

    static String[][] coffee = new String [50][2];

    public static void main (String [] args) {
        int choice = 0;

        while (choice != 4) {

            menu ();
            choice = Integer.parseInt (sc.nextLine() );

            if (choice == 1) {
                System.out.print('\u000C');
                addItem();
            }
            else if(choice == 2) {
                System.out.print('\u000C');
                search();
            }
            else if(choice == 3) {
                System.out.print('\u000C');
                show();

            }

        }
        System.out.println ("Goodbye");
    }

    public static void menu () {

        System.out.println ("main menu");
        System.out.println ("1. add coffee");
        System.out.println ("2. search coffee");
        System.out.println ("3. show coffee");
        System.out.println ("4. quit");

    }

    public static void addItem () {

        String name = "";
        String price = "";

        System.out.println ("enter coffee name");
        name = sc.nextLine();

        System.out.println ("price of coffee");
        price = sc.nextLine(); 

        coffee[numberOfCoffees][0] = name;
        coffee[numberOfCoffees][1] = price;

        numberOfCoffees++;

        System.out.println (name  +  " has been added to the list");

    }

    public static void search () {

        System.out.println ("search coffee");
        System.out.println ("what are you searching for?");
        String search =  sc.nextLine();

        int i = 0;
        int  cos = 0;

        String arrayName = coffee[i][0];
        if (arrayName == search){
            System.out.println("found" + coffee[i][0] + " £" + coffee[i][1]);
        } else  {
            System.out.println ("there is no coffee list yet, pleasse add");
        }
    }

    public static void show () {

        System.out.println ("Coffee List");
        if (numberOfCoffees > 0) {

            for (int a = 0; a < numberOfCoffees; a++) {
                System.out.println ("\n");

                System.out.println (coffee[numberOfCoffees-1][0] + " - £" + coffee[numberOfCoffees-1][1] );
            }

        } else {
            System.out.println ("there is no coffee in the list, please add");
        }

    }
}

Line 92 You just print the last item. Think about how to use the loop variable a

Also
Line 77 If you want to test for two Strings containing the same sequence of characters then use the equals method.
== tests if they are exacty same object.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.