Академический Документы
Профессиональный Документы
Культура Документы
Learning objectives
At the end of the topic you will be able to:
Introduction
How i H is it th that t most t of f computer programs provide us with important information? For example, how important is that I have a calendar on my phone or an alarm that goes on 30 minutes i t before b f th the h hour of fa very important appointment?
Introduction
All these applications pp arise from our needs, and from them, we face the challenge of how to translate a real problem to a representation which a computer can understand. First we could imagine an endless number of instructions consisting of zeros and ones, which is totally false. Nowadays, thanks to the simplicity offered by programming languages languages, we can represent real problems in very simple patterns that we both can understand: ourselves and computers.
We will start by understanding the definition of an object in the Java language. An object is a unit of code that contains a series of operations that can be used by programs to perform tasks.
Example of an object
Eagle Attributes Size: medium Color: Brown and white Speed: Very fast Strategy: Agility Operations Fly Eat Hunt Guard
Example of an object
Computer Attributes tt butes Size: 15 Color: Grey Year: 2009 Type: Laptop Operations Turn on Turn off Execute program Change users
Does not require information Requires the name of the program to execute Requires the name of the user to Change user change Turn off Does not require information
Classes
The classes contain the definition of the objects. To explain this better, consider a pan to bake cakes. The baking pan itself is the class and the cakes are the objects, so a class defines a specific type of object, but each object will have its own data.
10
Classes
Identifying the objects can help to design a class. The class is the definition of an object object. The objects are a unique instance of a class.
Attributes Name: Sparky Color: Brown and white Breed: Not registered Size: Medium
Classes
In the example we can notice that the class Dog defines two objects, and each of them is a unique instance of the class. What is the similarity between these two objects? That they both belong to the class Dog, so they have the same attributes defined: name, color, breed and size.
Classes
If we want to design the class Soft drinks, the first thing to d i do is t to d define fi th the attributes tt ib t , those th properties ti that th t distinguish an object (soft drink) from another:
Classes
Once we have the attributes, we can proceed to define the methods th d , the th actions ti we can perform f with ith th the object bj t (soft ( ft drink).
15
Closing arguments
An object in the Java language is a unit of code that contains a series of operations that can be used by programs to perform tasks. tasks Classes contain the definition of objects. An object consists of methods, which define the behavior of the object and of attributes or fields which define the state of the object. Starting from these definitions, we will begin to study the syntax of the Java language.
16
Bibliography
Fundamentals of the Java Programming Language (SL-110-SE6) http://www.sun.com/training/catalog/courses/SL-110 SE6.xml
17
Credits
Content Author Ing. Javier Castro Ruiz, MATI Academic Coordinator Lic. Nelly Maldonado Gonzlez, MEA Translating Teacher Lic. Nelda Contreras Leal, MA Instructional Designer Lic Dalila de Len Bauelos Lic. Bauelos, MTE Graphic Designer Lic. Miguel ngel Reynosa Castro, MANM
18