New to JavaProgramming Center
Java Platform Overview |
Getting Started |
Step-by-Step Programming
![]()
Application ObjectsThe Java programming language has a lot in common with everyday life. Each day you use objects, such as the car you drive, the meals you eat, and Internet pages you read.
Java applications are also built of objects, such as buttons, scroll bars, menus, and text areas. In addition, objects do something. Your car gets you from one place to another. To do that, it has to have function, or many functions. Software objects also have function. For action to take place in Java objects, blocks of code called methods are used. Methods tell an application what to do when buttons are clicked, menus are opened, and text is typed. Methods are either predefined or are created from scratch to manipulate objects, or the data within those objects. The Dive Log application you're going to create consists of many objects. These objects are based on classes that detail how the object is defined and how it behaves. This lesson covers the basics of using predefined classes and creating, or designing, new objects with your own classes. In addition, you'll learn how to work with objects by calling predefined methods and writing new methods to get the application to do what you want it to do. PreparationBefore learning about the code for the Dive Log, you need to create a special directory for the files and images that build this application. The Dive Log is designed from many classes, therefore many files. Keep them organized and in place.
Dive Log ObjectsThe concept of software objects is easier to understand with a real world example. Everything you're going to create for the Dive Log application is an object, including the application itself. The Dive Log application main screen lists some of the visible objects.
Each object has its own characteristics, or state. The Title object is different from the Tab objects, and the Image objects are different from the Text Area objects. But before an object comes into existence, its design must be written. Before cars and houses are built, someone designs a blueprint. Before a batch of cookies is baked, a recipe is written. Software objects are also created with a specific design. The design for a software object is called a class. Classes detail, or specify, exactly how an object should appear and how it is to behave. Instructions for creating software objects are carefully written into the class using variables for data and information, and methods for manipulation of that data and information.
| |||||||||
|
| ||||||||||||