5 The Structure of Java Programs. Every Java program consists of a collection of classes–nothing else. A class is a template for creating a particular form of object . Each object created by the template contains the same members, each of which is either a field or a method.