Results 1 to 4 of 4
- 01-31-2012, 01:10 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 48
- Rep Power
- 0
Question about arrays and methods
Hi there.
I have a question in respect to arrays and methods. Here goes: I have two classes. One class holds the method while the other class calls the method. The class that calls the method also declares an array. So, it looks like this:
class 1:
int array[] = new int[1];
array[0] = 10;
MyClass myclass = new MyClass;
myclass.Method(array parameter?)
Class 2:
public void (array parameter?) {
return array parameter;
}
As you can see I am trying to figure out how to call an array within a method of another class. What is the correct way of putting the array parameter? How do I do this? Please help! Thanks! :)
- 01-31-2012, 02:27 AM #2
Re: Question about arrays and methods
To call a method in another class you ether need to:
1. Make a object out of the class and call it by object.mehod();
2. Make it static then call it by Classname.method();
You have two choices , pick one
And remember to have the get method public . I didn't fully understand your question though.
- 01-31-2012, 02:37 AM #3
Member
- Join Date
- Dec 2011
- Posts
- 48
- Rep Power
- 0
Re: Question about arrays and methods
Hey there!
I am trying to figure out how to use a method call to with an array as the parameter. The array being in the other class. How do I do that? Thanks for your help though :)
- 01-31-2012, 02:45 AM #4
Similar Threads
-
Using Arrays and Overloading Methods.
By dalek in forum New To JavaReplies: 5Last Post: 10-25-2011, 04:52 AM -
Instancing methods in arrays possible?
By KReative in forum New To JavaReplies: 9Last Post: 10-09-2011, 01:54 PM -
Arrays and methods
By namie in forum New To JavaReplies: 3Last Post: 10-05-2009, 09:43 AM -
methods, classes, arrays.. oh my!
By katalyst in forum New To JavaReplies: 30Last Post: 03-30-2009, 12:57 AM -
Arrays & Methods
By TheRocket in forum New To JavaReplies: 1Last Post: 12-10-2008, 07:37 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks