문자열과 int값을'+'연산자로 연결하면 문자열로 변경할 수 있다.
public class intToString {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int a = 123;
bw.write(a+"\n");
bw.flush();
bw.close();
}
}
'JAVA' 카테고리의 다른 글
Annotation 동작 원리(2) (0) | 2023.08.07 |
---|---|
Annotation 동작 원리 (1) (0) | 2023.07.31 |
추상 클래스/ 인터페이스 (0) | 2023.03.22 |