← Back

Input & Output in Java

Console IO using Scanner & System.out; basics of files.

javaiobasicsUpdated 2025-09-01

Console

  • Scanner sc = new Scanner(System.in);
  • int n = sc.nextInt();
  • System.out.println(n);

Files

  • Use Files.readAllLines(Path) for quick reading.
  • Try-with-resources auto closes streams.