Search:

Type: Posts; User: helloworld922

Search: Search took 0.09 seconds.

  1. Replies
    13
    Views
    2,572

    Re: Not sure what type of variable to use.

    mm, I think this is the easiest method but that method is very simple too :P

    public A(){
    ID = hashCode();

    }


    The only thing you have to be careful of is if you ever choose to override...
  2. Replies
    13
    Views
    2,572

    Re: Not sure what type of variable to use.

    Alternatively, you can generate random numbers for the ID. However, do note that this method is not guaranteed to give you a unique ID every time.

    If you want a completely unique number, I believe...
  3. Replies
    13
    Views
    2,572

    Re: Not sure what type of variable to use.

    Will randomly generated ID's work? If not, you can always use the hashCode() function to assign a more or less unique ID as long as you use the default Object class's hashCode() method.

    public...
Results 1 to 3 of 3