aspose file tools*
The moose likes Beginning Java and the fly likes pass integer array values from class A's method  to class B's method ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "pass integer array values from class A Watch "pass integer array values from class A New topic
Author

pass integer array values from class A's method to class B's method ?

raj vin
Greenhorn

Joined: Mar 17, 2007
Posts: 12
How to pass integer array values from class A to class B ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Raj,
The same way you pass any parameter.

A-method() {
int[] array = ...
b.method(array);
}


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Srikanth Ramu
Ranch Hand

Joined: Feb 20, 2007
Posts: 76
If Class B extends Class A then you can directly use the variables of Class A provided they are not private variables.
Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
I would like to add that an array(Primitive array) is no different from any other object in java, as far as its storage on heap is concerned. The only difference(shared by String objects too) is that its objects can be directly typed in your code.


Sid
Njoy!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pass integer array values from class A's method to class B's method ?