Results 1 to 2 of 2
  1. #1
    roud9 is offline Member
    Join Date
    Sep 2010
    Posts
    20
    Rep Power
    0

    Default Keeping data in memory

    Hello,

    I am writing a program that automatically generates letters, requests the user to enter and compared with one another, but at the time of the comparison, they are no longer there, only the latter is kept in memory. How can I do for store all caracters?

    Java Code:
    static int aleatoire;
    static Random generateur = new Random();
        final static char[] lettresAleatoires =
        {
            'R', 'B', 'O', 'V', 'J', 'F', 'I', 'N'
        };
            for (int i = 0; i < 3; i++)
            {
                genererLettres();
            }
        private static void genererLettres()
        {
            aleatoire = generateur.nextInt(8);
            System.out.println(lettresAleatoires[aleatoire]); 
            // Here I put the letters in a table,  but I don't know how to do this
        }
    Thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You store things by putting them into variables including simple primitive variables, reference variables, arrays, collections such as array lists, and so forth. Your code above won't compile, by the way as you appear to have a for loop hanging in no-man's land.

Similar Threads

  1. Keeping a graphic central
    By Josisco in forum AWT / Swing
    Replies: 1
    Last Post: 10-24-2010, 06:38 PM
  2. loading data in memory
    By robby14 in forum Advanced Java
    Replies: 10
    Last Post: 04-18-2010, 02:29 PM
  3. Problem with keeping values into an arrayList
    By Daniel Silvester in forum New To Java
    Replies: 0
    Last Post: 12-02-2009, 01:14 AM
  4. Java Keeping Text in One Place
    By xpngamer in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 06:27 AM
  5. Replies: 2
    Last Post: 08-21-2008, 07:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •