Q: Is there any better way to get the value from an array? I have assigned the value
Menu[] food = {new Menu ("A01", "Burger", 10.00), ...}
Menu[] drinks = {...}

in main function
When i want to get the value of price as user input the ID at another function from both arrays, i am using two for loop to get the price
for (int i = 0; i < food.length; i++){
    do{
        if(food[i].getMenuID().equals(id)){
            //codes
        }
    }while(!food[i].getMenuID().equals(id));
}
for (int i = 0; i < drinks.length; i++){
    do{
        if(drinks[i].getMenuID().equals(id)){
            //codes
        }
    }while(!drinks[i].getMenuID().equals(id));
}


can i know is there any better way to get the price value?

A: The while loop is absolutly useless, just do it with one
String id = "A01";
Menu toFind = null;

for (int i = 0; i < food.length; i++){
    if(food[i].getMenuID().equals(id)){
        toFind = food[i];
        System.out.println("Got it !");
        break;
    }
}

The correspondant solution using Streams (java>8) is the following
Menu myMenu = Arrays.asList(food).stream().filter(menu -> menu.id.equals(id))
                                          .findAny().orElse(null);


A: You can also use (if you use java 1.8+):
String id = "A01"

Menu myMenu = Arrays.asList(food)
.stream()
.filter(menu -> menu.id.equals(id))
.findAny()
.orElse(null);


A: Considering that you want to get prices by the menu item's key, it's better to use a hash map in that case (Map.of(...) is from Java 9) :
Map<String, Menu> drinks = Map.of("A01", new Menu ("Cola", 10.00),
                          "A02", new Menu ("Fanta", 11.00));
Manu menu = drinks.get("A01")

Or you can use streams API (Java 8+) if you don't like the approach with maps:
Menu[] food = {new Menu ("A01", "Burger", 10.00), ...}
String menuIdToSearchFor = "A01";
Optional<Menu> optionalMenu = Arrays.stream(food)
       .filter(menu -> menuIdToSearchFor.equals(menu.getMenuId())
       .findFirst()
       .orElse(...);

