A binary file contains data that is not encoded as text. This file has contents in binary format, which means they cannot be understood by viewing them in a text editor. Examples are images, music, and the .class extension files which are created after compiling Java programs.