F
F
Fedor unknown2019-02-17 20:39:40
Java
Fedor unknown, 2019-02-17 20:39:40

How to enter arrays on the console humanly?

Hey!
there is an ordinary array: int[] array = {0,1,2,3};
if you enter on the console then output as a hash,
you have to use Array.toString
questions: 1. Why is the output displayed as a hash?
2. Why use Array.toString?
(in case of a two dimensional array Array.deepToString?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
illuzor, 2019-02-17
@turdubekov

Why is the output displayed as a hash?

Because the toString() method of the Object class is used, since arrays are inherited from it.
Not an Array, but an Array s . Because arrays don't have methods to output the contents as a string, you have to use the Arrays utility class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question