File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Arrays.fill( ) - java 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arrays.fill( ) - java 2" Watch "Arrays.fill( ) - java 2" New topic
Author

Arrays.fill( ) - java 2

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
How shall i pass the int array values from one java class to another java class thru Arrays.fill() (java 2)?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

I'm sorry, I don't understand your question. Can you be more specific about what you're trying to do?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
Hi Marc, Is it possible to pass(transfer) the integer array values from one class to another class thru Arrays.fill() (java 2)?
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
ie: int[] intArr = new int[10];
int intFillValue = -1;
Arrays.fill(intArr, intFillValue);

How can i pass intArr to another class ?
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
ie: int[] intArr = new int[10];
int intFillValue = -1;
Arrays.fill(intArr, intFillValue);

How can i pass intArr to another class ?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Kri,

You don't pass an array to another class using Arrays.fill(). You pass an array as a parameter in a method. Example:



If you want to fill an array with values using Arrays.fill() prior to passing it to another class, that's fine, but the actual passing of the Array to the other class is done through passing of a parameter to a method.


Merrill
Consultant, Sima Solutions
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1365
Hi Merril,How shall i pass 1 to 20 as my integer array values from class A to class B ?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18101
    
  39

Originally posted by kri shan:
Hi Merril,How shall i pass 1 to 20 as my integer array values from class A to class B ?


An integer array is just an Object. You may pass it around just like any other object. Options include...

- Having your instance A call a method of instance B with the object.
- Having your instance B call a method of instance A to fetch the object.
- Having your instance A place the object in some reference, which will be fetched by instance B at a later time.
- etc.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Arrays.fill( ) - java 2
 
Similar Threads
Comparing Arrays
Slightly confused with object value = null.
Prime numbers
binarySearch( ) method doubt
Initializing array to containg single value of elements