• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Char Array Problem

 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!!!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume you have the answer now?
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I presume you have the answer now?


yep. Thanks for the posts guys!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic