🧭 CapCompassfree study planner

Basic Input Output and File Handling — Class 11 ISC Computer Science revision notes

A 3-page visual revision sheet for Basic Input Output and File Handling, written for Class 11 ISC Computer Science. Formulas, diagrams and the traps that cost marks, laid out to be read the night before rather than the term before. Free, and it opens inside CapCompass.

Basic Input Output and File Handling revision notes, page 1 of 3 Page 1 as PDF
A preview of page 1 — all 3 pages open full size in the app.

Basic Input Output and File Handling in one look

reading the keyboard, printing back, and keeping the result after the program ends

Reading input with Scanner

  • import java.util.Scanner; brings the class in, and Scanner input = new Scanner(System.in); opens a channel to the keyboard
  • input.nextInt() reads one int, input.nextDouble() reads one double, input.next() reads one word up to the next space
  • input.nextLine() reads an entire line, including spaces, up to where Enter was pressed
  • each next call waits for input before the next statement runs, so print a prompt with System.out.print before every read

The nextInt then nextLine trap

the previous read on this Scanner was

  • nextInt() or nextDouble() — the Enter key press is still waiting unread: a nextLine() straight after reads an empty line
  • nextLine() already — the line is fully consumed: the next nextLine() reads cleanly
  • next() — the Enter key press is still waiting unread: the same fix as after nextInt() is needed

Fixing the nextInt then nextLine gap

  • nextInt() reads only the digits, and leaves the Enter key press sitting unread in the input
  • a nextLine() called straight after nextInt() reads that leftover Enter and returns an empty String, not the line the user meant to type
  • an extra input.nextLine(); with its result thrown away, placed right after the nextInt(), clears that leftover Enter
  • this exact ordering is one of the most reliable questions asked on Scanner, since it looks correct and still returns the wrong value

A file's life in a program, in order

  1. open
  2. read or write
  3. repeat
  4. close

Page 1 of 3. The full sheet, all 3 pages, opens free in the app.

What this Basic Input Output and File Handling sheet covers

Open the full Basic Input Output and File Handling sheet →Free, works offline, no account needed. All 3 pages, plus a study plan built around your own exam dates.

How CapCompass uses this sheet

These notes are not a standalone PDF. CapCompass plans Computer Science chapter by chapter against your real exam dates and free hours, and when the plan reaches Basic Input Output and File Handling the sheet opens inside the study block itself — at the page covering the sub-topic that block is on, with the timer still running. Revision arrives at the moment the plan says revise, instead of having to be gone looking for.

More Computer Science Class 11 revision notes