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

query

 
sid dutta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we return arrays of any type through a function

if yes then please give an example
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to know that can there be a return type of any type of array
 
Arpit Sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes you can return Object [] for any type

example is as

public Object [] abc(){

return new String []{"1","2"};
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic