Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

output the values in an array

Hi,

I am going through below example
http://www.avajava.com/tutorials/lessons/whats-a-quick-way-to-output-the-values-in-an-array.html?page=2

ArrayUtils.toString() is a great way to display the values of simple data types. For more complex data types, like JavaBeansW, you can use ArrayUtils.toString() in conjunction with ToStringBuilder.reflectionToString() in the toString() method of your complex data type to display the values of your objects in your array.


I have not understood what author meant by above line.

please advise
Any links resources ideas highly appreciated. Thanks in advance
SOLUTION
Avatar of Sharon Seth
Sharon Seth
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

in this link where they used

ToStringBuilder.reflectionToString() in that toString() method code you write.

Any other links to understand this concept better
>> where they used
In the class TestClass.
Method:

public String toString() {
    return "\n" + ToStringBuilder.reflectionToString(this);
}

Open in new window

Avatar of gudii9

ASKER

the ArrayTest class contains an inner class called TestClass.

I wonder why author used inner class in this case. please advise
In this (simple) case TestClass could have been perfectly a "global" class too.

When should inner classes be used in Java?
Avatar of gudii9

ASKER

I wonder what  is a need for inner class even after reading the link you posted.
That article gives a nice example. I can't do any better. Sorry.
Thanx 4 axxepting