본문 바로가기

텍스트 파일: 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.
  • On the exam: reading a text file with File and Scanner is AP CSA topic 4.6. Writing with PrintWriter is not examined; we use it here to create the file we then read.

A program writes to a file on disk and later reads it back

교재 자료

로그인 또는 계정 만들기

IGCSE, A-Level & AP