Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Making an array in Eclipse in Java format


  • Please log in to reply
1 reply to this topic

#1 sidd0123

sidd0123

  • Banned
  • 81 posts
  • OFFLINE
  •  
  • Local time:04:43 AM

Posted 15 December 2009 - 07:18 PM

In school we use eclipse as our our platform for writing our code. The language is java. I dont understand how to make an array. Can anyone write up an array and explain what each part does. Thanks

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:02:43 AM

Posted 15 December 2009 - 08:14 PM

Declaring an array is done like so:
String[] myArray;

This declares an array of Strings that is called 'myArray.' We know it is an array because the declaration has square brackets in it. To instantiate the array, we do this:
myArray = new String[5];

This creates an instance of our array that will hold 5 items. If we do not know how many items will go in our array, we instantiate it using a default constructor, like this:
myArray = new String[];
The default size of an array is (iirc) 1000 elements, or something like that.

This is a tutorial from Sun Java that may be useful.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users