Java Objects

This is a tutorial about creating and passing Java objects from one class to another. This is a good place to begin reading our tutorials. It begins the process of explaining a very accurate explanation from an IBM article on latitude and longitude, and how they can be used to create a grid of the Earth.

Here is a diagram of the class we will use to explain the passing of objects:

IBM_Obect_Layout

Here is our main entry to our project:

This class represents five method calls, one “main” we will leave for another discussion, the other four method calls to four different classes: 2 to go from latitude/longitude to one of either UTM or MGRS and 2 to do the reverse. We could for the sake of argument taken only one method call so the class would have looked like this:

Now, getting back to the the entry into our project. Our second method’s call: public String latLon2UTM(double latitude, double longitude) wants us to give it a latitude and longitude, and they are expected to be of type double.