This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Returning an Array from a Method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Returning an Array from a Method" Watch "Returning an Array from a Method" New topic
Author

Returning an Array from a Method

Tony Costello
Greenhorn

Joined: May 10, 2009
Posts: 2
Hello all I am attempting to write a method which gathers values from a text file, sticks em in an array and return the array.

I keep getting an error upon compiling:

java:41: '.class' expected
return age[];


Here is my code:

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16690
    
  19

The parameter "age", is an int array, and you need to return an int array... so...



is what you want.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Tony Costello
Greenhorn

Joined: May 10, 2009
Posts: 2
Oh geez.....thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning an Array from a Method
 
Similar Threads
Using method on a program
Doubt Reg: initializing Variables with method call
problems with math methods