my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Calling function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calling function" Watch "Calling function" New topic
Author

Calling function

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 818
How do I reclare an int array, call this function, and receive the return value into the int array? Was trying a few things out and keep getting errors when compiling.



>
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Howdy, Rob!

How about this one:



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

Joined: Apr 09, 2002
Posts: 818
Hi Roberto, Thanks for the message. One thing though. If I were to try and use :


I get the following error when trying to compile. This is probably a very basic call on your part but I'm not sure what the issue is here. Could you take a look and see if you can determine the cause? Thanks again, really appreciate the help.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  19

Why does assignInt return an ArrayList<Integer>, and not an int[]?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Howdy, Rob!

Champ, I think that, in your scenario, the most appropriate decision would be to follow my good buddy Rob Prime's suggestion. Instead of returning ArrayList<Integer>, your assignInt method could return int []. This would ease a lot your work.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  19

Roberto Perillo wrote:Howdy, Rob!

Howdy!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
Roberto Perillo wrote:Howdy, Rob!. . .
And we now have somebody on this thread who isn't called Rob
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Campbell Ritchie wrote:And we now have somebody on this thread who isn't called Rob


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling function