Arrays T_T

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KirbyIwaki
    New Member
    • Feb 2009
    • 2

    Arrays T_T

    I have a global variable, something like this:

    Code:
    public class Comisiones {
    	
    	double monto,max=0,min=0
    Now... I have a Comisiones array, declared in the main, something like this:

    Code:
        public static void main(String[] args) {
            Comisiones x[]=new Comisiones[20];
    That means each Comisiones object will have its own monto, max, and min variables... but what if I want to use these variables for all the array (for example min being the minimal price for all the objects)... what do I do to solve this?

    Thanks in advance n.n!
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by KirbyIwaki
    That means each Comisiones object will have its own monto, max, and min variables... but what if I want to use these variables for all the array (for example min being the minimal price for all the objects)... what do I do to solve this?
    Either lift those min and max variables out of the class and store them once somewhere else or leave them in that class and make them static.

    kind regards,

    Jos

    Comment

    • KirbyIwaki
      New Member
      • Feb 2009
      • 2

      #3
      Originally posted by JosAH
      Either lift those min and max variables out of the class and store them once somewhere else or leave them in that class and make them static.

      kind regards,

      Jos
      I static-ized them, thanks n.n!

      Comment

      Working...