The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Concept problems!

Posted by Joe on October 01, 2000 at 8:13 PM

I have a class, AClass, the constructor is AClass(int num), within the constructor, an myArray[] is created, with the
myArray.length = num;
Within the AClass, there is a method: print(int []myArray), which prints out the array that is just created under the constructor.

Now, I create a new class to implement the AClass:
public class Test
{
public static void main(String[] args) {
AClass aClass= new AClass(20);
// problem here, wanna call the print() method to print
// out the array
}
}

Can anyone help me? I think I can do like this:
aClass.print(...);
What should I put in the argument? I put:
aClass.print(int[] myArray);
But I got error message.

Thank you for any help!

Joe




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us