• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

array  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a new member of this forum.so i would like to know about array very clearly and simple.
thanks a lot.
emran.
 
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what you mean by array. You can look in the API at Array, or ArrayList, or whatever and get a good understanding of classes of Arrays
http://java.sun.com/products/jdk/1.2/docs/api/index.html
If you are meaning an array of objects or simple values, it's just really a collection of similar things, and each item in the collection is designated by an index, with the first item being 0, the next being 1, etc.
For instance, if I want to have a group of names, I could do something like:

This is a simple example, and this is not the only way to initialize an array.
Since arrays always start at 0, "Ted" is at index 0, "Fred" is at 1, "Tim" is at 2, and "Jim" is at 3.
If I wanted to print out the last name in the array, I would do:

That's pretty much the basics of arrays, though there are a lot of more complicated things you can do with them.
What's your experience so far with arrays? If you are new to Java, or programming in general, check out http://www.javaranch.com/books.jsp for a listing of good books.
Jason

[This message has been edited by jason adam (edited September 01, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!