강의

멘토링

커뮤니티

Inflearn Community Q&A

seoyunlee's profile image
seoyunlee

asked

Java with Pictures, Part 1: Introduction!

조건문 if-else 강의에서 궁금한 점

Written on

·

232

0

변수를 생성할때,
String result; 와
String result = ""; 의 차이점이 뭔가요?
java

Answer 1

1

hongpark님의 프로필 이미지
hongpark
Instructor

String result; 는 변수만 만든 것인 반면

String result = "";는  변수를 만들고 빈문자열로 값을 지정(초기화) 차이가 있습니다.

 

PS.

일반적으로 메소드 내부에 선언된 변수는 값을 초기화해야합니다.

더 자세한 내용은 "자바 변수 선언과 값 할당"으로 검색해보세요.

seoyoun44님의 프로필 이미지
seoyoun44
Questioner

감사합니다!

seoyunlee's profile image
seoyunlee

asked

Ask a question