Information in a File

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

All information in any file is kept in binary form.

Information in a File

Since we are dealing with digital computers, the information in the computer system is represented in binary form. Remember the four advantages of binary (from chapter 2):

  1. Simple; easy to build.
  2. Unambiguous signals (hence noise immunity).
  3. Flawless copies can be made.
  4. Anything that can be represented in symbols can be represented with patterns of bits.

The last advantage means that a file can contain any type of information that can be represented with symbols, such as:

  • numbers (integers and floating point types of any size)
  • characters (text files)
  • characters with format information (word processor files)
  • images
  • audio
  • program source files ( MyProgram.java, cprogram.c )
  • bytecodes ( MyProgram.class )
  • machine language ( cprogram.exe )
  • many other types

QUESTION 4:

Can a file hold any type of information that can be held in a main memory?