View Single Post
Old Jun 29th, 2012, 1:36 AM   #10
macteki
Professional Programmer
 
Join Date: Jul 2011
Posts: 437
Rep Power: 3 macteki will become famous soon enough
Re: Problem Reading a File

Quote:
Originally Posted by PaCkEtPiRaTe View Post
Well, I'm not really sure how it worked, but it did.
It worked because showInputDialog() is expecting String array instead of Object array. If you passed an object array into it, the default "toString()" method would be called, which is implementation dependent.

Quote:
Originally Posted by PaCkEtPiRaTe View Post
I didn't see any versions of that method that took any arguments... what did it do differently?
There are two method declaration for toArray() in java.util.Set

1. Object[] toArray()
Returns an array containing all of the elements in this set.

2. <T> T[] toArray(T[] a)
Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.

See this link for reference.

http://docs.oracle.com/javase/6/docs.../util/Set.html
__________________
API belongs to public. Knowledge belongs to yourself

http://java.macteki.com
macteki is offline   Reply With Quote