Search:

Type: Posts; User: Zigster

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    3,610

    Re: Storing object with int values in Arraylist.

    Thankyou quad64bit and Tolls, especially for your examples, took me awhile to understand what you were doing, but it's exactly what I wanted.


    package Main;

    import java.util.ArrayList;
    import...
  2. Replies
    12
    Views
    3,610

    Re: Storing object with int values in Arraylist.

    Yes, I read the posts, I don't believe that actually answers my question. I didn't ask how to print out a string that contains the ints (my original code already does this), I want to access the ints...
  3. Replies
    12
    Views
    3,610

    Re: Storing object with int values in Arraylist.

    If I am adding Gladiators to an ArrayList:


    package Main;

    import java.util.ArrayList;
    import java.util.List;

    public class Main {
    public static void main (String[] args){
  4. Replies
    12
    Views
    3,610

    Re: Storing object with int values in Arraylist.

    Is this what you mean? How do I access the stats from outside this class? Cheers.


    package Main;

    import java.util.Random;

    public class Gladiators {

    Random generator = new...
  5. Replies
    12
    Views
    3,610

    Re: Storing object with int values in Arraylist.

    I want each Gladiator instance to have a different set of random stats/attributes (str, agility, stamina, speed), so I can add the gladiator objects to an arraylist, and then retrieve the info for...
  6. Replies
    12
    Views
    3,610

    Storing object with int values in Arraylist.

    I have made this class to create the stats of game characters from random numbers. But if I store the object in an ArrayList, everytime I reference the object the stats re-randomise. How can I make...
Results 1 to 6 of 6