
As we know array holds the similar kind of elements, then in collection how toArray() method will convert the collection having different objects to an array having similar objects in java?

Hi , all collections store the any element in the form of Object class type. The toArray() method return the Object[]. This Object[] contain the all passing elements into collections in the form of Object data type..
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.