형님들 안녕하세요.

 

간단한 예제 실습중 막히는 부분이 있어 질문 드리려고 글 올립니다..

 

그냥 nextInt를 사용해서 랜덤 수를 txt파일로 저장하려고 하는데.. print로는 숫자가 정상적으로

 

출력 되는데 왜 파일에 쓰면 이상한 특수문자가 써지는지 모르겠습니다..ㅠㅠ

 

int a = 0;  

BufferedWriter outFile = new BufferedWriter(new FileWriter("C:\\Javaexample\\data\\example.txt", true));
  
  Random random = new Random();
  a = random.nextInt(9);
  System.out.print(a);
 
  outFile.write(a);
  outFile.close();

 

왜일까요 ㅠㅠ.. 답변 주시면 감사하겠습니다!!