- (Array 요소 출력하기)
String[] helloWorld = {"Hello", "World"};
System.out.println(helloWorld);
System.out.println(Arrays.toString(helloWorld));
output
[Ljava.lang.String;@45a877
[Hello, World]
- (한 줄의 여러 값 한 번에 입력하기)
String input = scanner.nextLine(); // get the entire line after the prompt
String[] numbers = input.split(" "); // split by spaces
- (변수 타입 판독)
var.getClass()
- 조건문에서 String 변수 간의 상등을 표현할 때 == 연산자보다 .equals() 메서드를 사용하니 결과가 올바르게 도출된다.
'WIL(What I Learned)' 카테고리의 다른 글
21.11.22 月 (0) | 2021.11.22 |
---|---|
자바정석 Chap.6 연습문제 답안 확인 모음 (0) | 2021.11.19 |
21.11.1 月 (0) | 2021.11.02 |
코드업 100제 6096번 바둑알 뒤집기 문제 (0) | 2021.10.31 |
21.10.24 (0) | 2021.10.24 |