aspose file tools*
The moose likes Beginning Java and the fly likes For that if use the array? Which is the its main function? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "For that if use the array? Which is the its main function?" Watch "For that if use the array? Which is the its main function?" New topic
Author

For that if use the array? Which is the its main function?

Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

Hello all!

For that if uses the ARRAY ? Which is the its main function ?
Examples use please.

Thanks by opportunity!

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

Welcome to the Ranch!

Learn about arrays in The Java Tutorials - Arrays.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

Thanks, I read!

See my code:



There was one error. I make with that the code is printed with the FOR, and no as shown in tutorial.
How do that the problem is corrected ?
Thanks!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2247

Fala Gustavo!

Champ, how do you get one element of your array (hint: use the start variable)? And second: verify if you are iterating more than the actual length of your array.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Murtaza Lokhandwala
Ranch Hand

Joined: Jan 28, 2010
Posts: 35
replace start <= anArray.length with start < anArray.length
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

Thanks you all!
Very good!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2247

Fala Gustavo! Tudo bem?

So, were you able to make it work? Can you show us your final code?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10916
    
  12

i'm guessing your code still doesn't quite do what you want.

In fact, It gives me a compilation error. Remember than an array is a CONTAINER of things, not the things themselves. If you had an egg carton full of eggs, you don't try and put the carton into your cake batter, but some of the things inside the container.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

Grateful by response!
The problem resolved!
Thanks you all of JavaRanch!

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
A nearby thread suggests another way to create your arrayThe new int[] bit and the , shown in the /* */ comment are optional. If you don't have the declaration on the same line, then the new int[] bit becomes compulsory.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19544
    
  16

In this case a loop is also an easy way, as there is a pattern between the indexes and the values:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For that if use the array? Which is the its main function?
 
Similar Threads
Accessing a method of an item of an array of objects
scope issues?
can anyone explain this...
travel agent - java writing to file via user input
Number of Columns