wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Char Array Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Char Array Problem" Watch "Char Array Problem" New topic
Author

Char Array Problem

Supun Lakshan Dissanayake
Ranch Hand

Joined: Oct 26, 2012
Posts: 132

Hi Everyone!!!
I was trying arrays. When I tried



this, the output was ABC; not the memory address of array object.

but if the array is byte, short, int, long, float, double, boolean it shows the memory address or array object as it should.

I need to know why CharArray program represent values of the array instead for it's memory address?

Regards!!!


Are you better than me? Then please show me my mistakes..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

I'll give you some hints to help you figure this out yourself.

1. What type of object is System.out? (Look it up in the API documentation of class java.lang.System).
2. Look at the API documentation of that class; lookup the println() method.
3. What did you find when you looked up the println() method? Can you now answer your own question?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Supun Lakshan Dissanayake
Ranch Hand

Joined: Oct 26, 2012
Posts: 132

Thanks!!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
I presume you have the answer now?
Supun Lakshan Dissanayake
Ranch Hand

Joined: Oct 26, 2012
Posts: 132

Campbell Ritchie wrote:I presume you have the answer now?


yep. Thanks for the posts guys!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Char Array Problem
 
Similar Threads
Failed to copy two dimensional array
System.out.println(char[] x);
toString() of a char array
string reverse O(N) or O(N/2)
how do you convert CHAR TO STRING