Hi guys,
I'm trying to call a static method within a static method of the same class, but I can't figure out how. In the tuneAll method below, I'm trying to call tune(Instrument an Instrument). When I try to compile it by just declaring tune(), it says I need an Instrument argument, so then I put Instrument.tune() and it says tune() cannot be found. What am I doing wrong?
/** * Calls the what(), adjust() and play() methods on the parameter which is an Instrument. * * @param anInstrument an Instrument in the hierarchy */ public static void tune(Instrument anInstrument) { anInstrument.what(); anInstrument.adjust(); anInstrument.play(); } /** * Tunes each instrument in the ArrayList by calling the tune method. * * @param e an ArrayList of Instruments */ public static void tuneAll(java.util.ArrayList<Instrument> e) { for (int i=0; i<e.size(); i++) { Instrument.tune(); } }