T
Thomas Korsgaard
Hi,
I'm doing a project in school in Java, and I've come a cross several
ways of programming, when dealing with classes. E.g. I have an Inventory
class, that obviously holds a lot of data about what is in the inventory.
When I deal with my main program i find that I can deal with it in two
ways. Either
Inventory inv = new Inventory();
inv.status();
inv.findLowStock();
or I can acces my Inventory "directly" by:
Inventory.status();
Inventory.findLowStock();
Both seem to be working fine, but what is the difference? And more
important what is the best thing to do (I like good marks )?
Thanks,
/Thomas
I'm doing a project in school in Java, and I've come a cross several
ways of programming, when dealing with classes. E.g. I have an Inventory
class, that obviously holds a lot of data about what is in the inventory.
When I deal with my main program i find that I can deal with it in two
ways. Either
Inventory inv = new Inventory();
inv.status();
inv.findLowStock();
or I can acces my Inventory "directly" by:
Inventory.status();
Inventory.findLowStock();
Both seem to be working fine, but what is the difference? And more
important what is the best thing to do (I like good marks )?
Thanks,
/Thomas