Communicating Objects

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:

Of course. To get the work done, humans (and objects) need to ask each other to do their specialized tasks and need to give each other information necessary for the jobs.

Communicating Objects

boss and workers

 

 

A running program is a collection of objects that are each doing their own task and communicating with other objects. The picture shows a running program (or a pizza shop). The jagged lines represent communication. The boss is special and so is drawn with dotted lines.

In Java programs the main() method is special because it is where the Java interpreter starts the whole program running. The main() method is a static method, which means that there will be only one instance of it and that it exists (as part of a class) before any objects have been created.

QUESTION 4:

Say that after a few days your object-oriented pizza business gets more orders than it can handle. What will you do?