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
Java EEJavaJSP

Avatar of undefined
Last Comment
zzynx
SOLUTION
Avatar of Sharon Seth
Sharon Seth
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of gudii9
gudii9
Flag of United States of America image

ASKER

in this link where they used

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

Any other links to understand this concept better
Avatar of zzynx
zzynx
Flag of Belgium image

>> where they used
In the class TestClass.
Method:

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

Open in new window

Avatar of gudii9
gudii9
Flag of United States of America image

ASKER

the ArrayTest class contains an inner class called TestClass.

I wonder why author used inner class in this case. please advise
Avatar of zzynx
zzynx
Flag of Belgium image

In this (simple) case TestClass could have been perfectly a "global" class too.

When should inner classes be used in Java?
Avatar of gudii9
gudii9
Flag of United States of America image

ASKER

I wonder what  is a need for inner class even after reading the link you posted.
Avatar of zzynx
zzynx
Flag of Belgium image

That article gives a nice example. I can't do any better. Sorry.
Avatar of zzynx
zzynx
Flag of Belgium image

Thanx 4 axxepting
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo