(1) GirlScout gs = new GirlScout("Rose", 2000, 20.50);
(2) GirlScout gs = new GirlScout();
gs.setName("Rose");
gs.setID(2000);
gs.setDue(20.50);
Other than making different format in the GirlScout class, is there any difference in the above two ways in writing.
Loading
VulpesPosted Jul 21, 2012, 11:12 AM
However, providing a constructor to initialize fields to sensible values is always good practice IMO. It's much easier for the user to write code such as (1) rather than (2).
Posted Jul 21, 2012, 11:15 AM