Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: how can I generation element in my code ?

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    My Mood
    Tired
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how can I generation element in my code ?

    hi ,

    I don't know how can I generation element in array ..
    ( IF the size of array = 100 ) , I need to use random generation ..


    And how can I use it in java code ?


    thanks ,
    Last edited by lelo; November 18th, 2012 at 09:20 AM. Reason: =$


  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: how can I generation element in my code ?

    refer Java API and Java specification on oracle website to understand.
    Last edited by copeg; November 16th, 2012 at 11:38 AM. Reason: removed externa blogl link

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: how can I generation element in my code ?

    Quote Originally Posted by lelo View Post
    hi ,

    I don't know how can I generation element in array ..
    ( IF the size of array = 100 )
    and how to initialization array ?


    thanks ,
    There are 2 ways to dealing with array.
    first is to create an array and filling up it's member one by one like the following:
    int[] arr = new int[100]; // create an array of integer with size 100
    arr[0] = 1; // assign 1 to the first index 
    arr[1] = 2; //assign 2 to second index, and so forth

    second way is create and populate its member at the same time as following :
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} // create and initialize array of int with 10 members

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,337
    Thanks
    182
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: how can I generation element in my code ?

    Have you read the tutorial at Oracle? Should be one of the first places to go to get the basics explained
    Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    My Mood
    Tired
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how can I generation element in my code ?

    Thanks for you ALL <3

    But I mean, When I initialization the array with 100 size , I need to use random generation ..

    And I don't know how can I use it ..

  6. #6
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: how can I generation element in my code ?

    Quote Originally Posted by lelo View Post
    Thanks for you ALL <3

    But I mean, When I initialization the array with 100 size , I need to use random generation ..

    And I don't know how can I use it ..
    Please clarify your statements above since they are very ambiguous. You will want to tell us *exactly* what you're trying to do including some of the detail.

  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    My Mood
    Tired
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how can I generation element in my code ?

    ^
    I'm sorry.
    well , i'll do that .

    thanks ..

  8. #8
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: how can I generation element in my code ?

    At your leisure.

Similar Threads

  1. pdf generation
    By deependeroracle in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: July 22nd, 2012, 01:11 AM
  2. PDF generation
    By deependeroracle in forum JDBC & Databases
    Replies: 2
    Last Post: June 26th, 2012, 10:29 AM
  3. [SOLVED] Help with password generation
    By Dr.Code in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 25th, 2012, 06:36 AM
  4. Okay Here Goes...World and Map Generation.
    By rooster5105 in forum Algorithms & Recursion
    Replies: 1
    Last Post: October 30th, 2011, 02:45 PM
  5. Is AgileUnit the next test generation?
    By ricardo7307 in forum Member Introductions
    Replies: 0
    Last Post: May 16th, 2011, 02:33 PM