Array Printing Java

后端 未结 3 1534
面向向阳花
面向向阳花 2021-01-28 12:05

Basically I want my code to enable the user to enter x amount of integers (they chose x), then they will then store each of their inputted integer values in my array.

Fo

3条回答
  •  一向
    一向 (楼主)
    2021-01-28 12:27

    The string you get is the object notation of array which is expected [I@55f96302 where

    • [I is the class name
      • [ one dimentional array
      • I integer array
    • @ joins the string
    • 55f96302 some hash code

    To print array do

    System.out.println(Arrays.toString(myArray));
    

    or you can simply loop through each element of array

提交回复
热议问题