Your arrays are currently local to the main method. If you move them outside the main method (just like they are), they will be visible to other classes in the same package, since they will have access to the package. You will need to have a reference to this class (unless you make them static). In the example below, I call class X
int [] HotDog = {18,8,10,0}; int [] ToastedChicken = {25,8,17,0}; int [] ToastedSteak = {30,8,22,0}; int [] ToastedEggT= {20,8,6,6}; int [] ToastedSteakE={36,8,22,6}; int [] ChickenRoll = {25,8,17,0}; int [] SteakRoll = {30,8,22,0}; int [] EggTomato = {20,8,6,6}; int [] CheeseTomato = {20,8,6,6}; int [] steakEgg = {36,8,22,6};` public static void main (int[] args) { jLabel2.setText(new X().HotDog[2]);
Also in java, you can name the variable names in camelCase. For example, chickenRoll
source share