Skip to content · ⁨본문 바로가기⁩

Text files: write and read with Scanner · ⁨텍스트 파일: Scanner로 쓰기 및 읽기⁩

English

Reading and writing text files

  • A text file stores text that stays on disk after the program ends.
  • To read a file in Java we use a Scanner connected to a File.
  • To write a file we use a PrintWriter. In this lesson each program writes a file, then reads it back.
  • Bonus lesson: the AP CSA exam does not test file input/output. Learn this for real programs — you will not be examined on it.
한국어

텍스트 파일 읽기와 쓰기

  • 텍스트 파일은 프로그램 종료 후에도 디스크에 저장되는 텍스트를 저장합니다.
  • Java에서 파일을 읽으려면 Scanner과 연결된 File을 사용합니다.
  • 파일을 쓰려면 PrintWriter을 사용합니다. 이 수업에서는 각 프로그램이 파일을 쓴 후 다시 읽습니다.
  • 보너스 수업: AP CSA 시험은 파일 입출력을 테스트하지 않습니다. 실제 프로그래밍을 위해 배우되, 시험 대상은 아닙니다.

Handout · ⁨교재 자료⁩

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP