Consider:
public proj 3 {
    static string [][]Item;
    public static void main(String [] args){
        Item[][] = {
             {"BH," , "Backhoe,"            , "200.00"},
             {"ER," , "Electric Rake,"      ,  "10.00"},
             {"EL," , "Electric Lawnmower," ,  "15.00"},
             {"TR," , "Trencher"            ,  "35.00"},
             {"MU," , "Mulcher,"            ,  "20.00"},
             {"TS," , "Tree Sprayer,"       ,  "22.00"},
             {"CP," , "Cider Press,"        ,  "30.00"},
             {"PR," , "Pruner,"             ,  "12.00"},
             {"GE," , "Gas Edger,"          ,  "20.00"},
             {"RO," , "Roller,"             ,   "8.00"},
How can I make it so I can call the array from a different method?
That means you have to initialize it like this:
public class Proj3{
    public static String [][] Item = {
              {"BH," , "Backhoe," , "200.00"},
              {"ER," , "Electric Rake," , "10.00"},
              {"EL," , "Electric Lawnmower," , "15.00"},
              {"TR," , "Trencher" , "35.00"},
              {"MU," , "Mulcher," , "20.00"},
              {"TS," , "Tree Sprayer," , "22.00"},
              {"CP," , "Cider Press," , "30.00"},
              {"PR," , "Pruner," , "12.00"},
              {"GE," , "Gas Edger," , "20.00"},
              {"RO," , "Roller," , "8.00"}
         };
public static void main(String [] args){
     ...
}
If you want to use the array initializer, you cannot split the declaration and assignment.
You have two options: In the declaration
private static String[][] item = {...};
OR
Elsewhere using the new keyword
private static String[][] item = new String[][]{...}
Also, you'll need to change public proj to public class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With