This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "query" Watch "query" New topic
Author

query

sid dutta
Greenhorn

Joined: Sep 07, 2008
Posts: 6
can we return arrays of any type through a function

if yes then please give an example
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39103
    
  23
Yes. You can create an array of any type and return it, or pass it as a parameter.
Can't think of a return type offhand, but there is a very common parameter . .

public static void main(String[] args)

!
sid dutta
Greenhorn

Joined: Sep 07, 2008
Posts: 6
i want to know that can there be a return type of any type of array
Arpit Sharma
Greenhorn

Joined: Sep 10, 2008
Posts: 8
yes you can return Object [] for any type

example is as

public Object [] abc(){

return new String []{"1","2"};
}


SCJP 1.5
 
GeeCON Prague 2014
 
subject: query