Programs and Their Execution





Programs consist of modules.  Modules in turn can contain statements, function definitions, and/or class definitions.  Each module is associated with a source file (.py extension) and possibly a byte code file (.pyc extension).










An comipler/interpreter called a Python virtual machine (PVM) translates Python source files to byte code before execution.  The PVM may save the corresponding byte code in files for subsequent executions.


Programs consist of interfaces and classes.  Interfaces and classes are contained in source files (.java extension).  A source file compiles into one or more executable byte code files (.class extension).


Classes and interfaces can be part of a package.  A package is a bit like a module, from which any resources can be imported.  The byte code files for a package are usually contained in a directory whose name is the package name. 


Programs must first be compiled before they can be executed.  Programs are either applets or applications.  Applets are programs that run in a Web browser.  Applications are programs that run on a standalone computer.  In either case, Java programs execute in an interpreter called a Java virtual machine (JVM).