If you are calling the getBrands() method directly from your MainActivity class then you just have to reference the array returned from the function in your MainActivity class. Here is how you can do it:
BeerExpert beerExpert = new BeerExpert();
String[] beer_brands = beerExpert.getBrands("light");
If you are not calling the getBrands() method from MainActivity class but from some other class and am only interested in the array declared in BeerActivity class then you'll have to declare it as static in your BeerExpert class:
public class BeerExpert {
/* Public Static */
public static String[] beer_brands = new String[2];
public String[] getBrands(String color){
if(color=="light") {
beer_brands[0]="Budwiser";
beer_brands[1]="Corona";
}
return beer_brands;
}
}
You can then import it as follows in your MainActivity class:
String[] beer_brands = BeerExpert.beer_brands;