Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling function

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Rob!

How about this one:

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does assignInt return an ArrayList<Integer>, and not an int[]?
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:Howdy, Rob!

Howdy!
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Sheriff
Posts: 48415
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:Howdy, Rob!. . .
And we now have somebody on this thread who isn't called Rob
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:And we now have somebody on this thread who isn't called Rob


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic