-
toString()컴퓨터/Java 2019. 11. 21. 09:44
- When we print out Objects, we often see a String that is not very helpful in determining what the Object represents. 주소를 보여준다든지...
- We can return a String that will print when we print the object.
public String toString() { }
- import java.util.Arrays;
array를 print하면 memory address가 나온다.
therefore we need a toString() method that is provided by the Arrays package in Java.
Arrays.toString(array객체) : can see the contents of the array printed out
출처 : codecademy
'컴퓨터 > Java' 카테고리의 다른 글
Conditionals and Control Flow (0) 2019.11.21 [Java 기본 02] Java file, java 프로그래밍 특징 및 작성법 (0) 2019.11.20 제네릭 (0) 2019.10.06 형변환 (0) 2019.10.06 Java.util.Arrays 클래스 (0) 2019.10.06