Question: What would be wrong with adding the following statement to Figure 7.24s main method? PennyJar.addPenny(); Figure 7.24 /****** * Penny Jar Driver.java *Dean & Dean
What would be wrong with adding the following statement to Figure 7.24’s main method?
PennyJar.addPenny();
Figure 7.24

/****** * Penny Jar Driver.java *Dean & Dean * *This class drives the Penny Jar class. *** public class PennyJarDriver ( public static void main(String[] args) ( PennyJar penny Jarl = new PennyJar(); Penny Jar pennyJar2 = new PennyJar(); 2 3 PennyJar.setGoal (4000); pennyJarl.add Penny (); penny Jarl.addPenny(); pennyJar2.addPenny(); System.out.println(pennyJarl.getPennies ()); System.out.println(Penny Jar.getAll Pennies()); } // end main 3 // end class Penny Jar Driver Output: Clink! Clink! Clink! */
Step by Step Solution
3.32 Rating (155 Votes )
There are 3 Steps involved in it
Because theres no static modifier addPenny is an insta... View full answer
Get step-by-step solutions from verified subject matter experts
