SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Originally posted by Ravi Srinivas:
Would just like to add that declaring constants such as DollarToEuro = 1.234 at the beginning of your class might be better.
Originally posted by Steven Bell:
I would just add that anytime I see more than a half a dozen lines inside a
'public static void main(String[] args)'
method I cringe and die a bit inside.
Ofcourse both the Gifts.class and ProgramProject3.class are in the same directory...
java amateur
Originally posted by Ryan McGuire:
However, if you're saying some of the code in this particular main() could be sucked out and put into a displayMenu() and performAction() methods, then I basically agree. BUT... the menu and the actions have to know about each other because they have to share the input-char-to-action correspondence. If you take the menu displaying and action taking code out of main(), there isn't a whole lot left.
This has to be considered on a case-by-case basis. (I hate how often I have to say that. But I guess that what keeps me employed. )
Ryan
making a contructor private means noboby outside your class can create an object of that typeWhen I change the Instance Variable and Constructor variable to private... I get the below compile error when I compile the ProgramProject3.java..???
the common practice is to mark vars private and then supply public accessors:I was under the impression that if I use private variables, I can still define a public method to display the private variables data?
java amateur
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |