Guys I recently discovered that char array can also be printed in java without for loop and the output is a string.But when i tried the same for int array, I got some gibberish value which i though to be memory address pointed by array as it contains reference to the array elements. I read the explanation given by one of the the programmer here but somehow I did not actually understand it.. Could anyone please explain it in a better way ??
Riya@23 0 Newbie Poster
Recommended Answers
Jump to PostNo, it's not any kind of Java language assumption.
println
is a method in thePrintStream
class. (System.out is an instance of PrintStream). It's overloaded for all kinds of parameters, one of which ischar[]
, and that version prints the array as a single String.
So the behaviour is an arbitrary …
Jump to PostMy pleasure.
Until next time.....
J
All 5 Replies
AssertNull 1,094 Practically a Posting Shark
Riya@23 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Riya@23 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.