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 ,
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.
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 10:20 AM. Reason: =$
refer Java API and Java specification on oracle website to understand.
Last edited by copeg; November 16th, 2012 at 12:38 PM. Reason: removed externa blogl link
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
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)
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 ..
^
I'm sorry.
well , i'll do that .
thanks ..
At your leisure.