aspose file tools*
The moose likes Beginning Java and the fly likes Returning an Array from a Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 18120
    
  39

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
Doubt Reg: initializing Variables with method call
problems with math methods
Using method on a program