go to previous page   go to home page   go to next page

Answer:

Or you could say that a class is a plan for an object and an object is what results when the plan has been carried out.


Object Oriented Programming

Object-Oriented programming consists of three stages:

  1. Creating the Program.
    • The programmer defines classes that describe objects that the program will use when it is running.
    • The programmer defines a class that contains the static main() method which is used to start the program running.
  2. Compiling the Program.
    • The program is compiled into bytecode.
  3. Running the Program.
    • The java interpreter looks for a static main() method and starts running it.
      • Since main() is static it can start running even though no objects have been created, yet.
    • As the program runs, objects are created and their methods are activated.
      • The program does its work by creating objects and activating their methods.
      • The exact order of object creation and method activation depends on to task to be performed and the input data.

The stage where the compiled program is running is called run time. Your program is like the script of a play. The work that you describe in your program (or play) is performed after you have finished the description and put it in the hands of the CPU (or actors). At run time (show time), Things Happen. Your beautiful program comes to life. Data is read in; calculations are performed; files are written.


QUESTION 2:

Object Oriented Programming is like assembling a team of human workers to get a job done:

  1. First you plan on the workers and material you will need.
  2. Then you assembly your workers and material.
  3. Then the team works with the material until the job is done.

(Thought question:) You have decided to open a pizza delivery business consisting of yourself and several employees. What job descriptions will these employees have?