The toString() method of JavaAbstractClass is used to return a string representation of the elements of the Collection.
The String representation comprises a list representation of the elements of the Collection in the order they are picked by the iterator closed in square brackets.This method is used mainly to display collections other than String type(for instance: Object, Integer)in a String Representation.
Parameter The method does not take any parameters.
Return This method returns a string representation of the collection.
Below examples illustrate the toString() method:
[For, Geeks, To, Welcome, Geeks]
[10, 20, 30, 40]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.