Documente Academic
Documente Profesional
Documente Cultură
• The purpose of methods is to provide a mechanism for accessing (for both reading and
writing) the private data stored in an object or a class
• For example, in the snow world, there is a method that causes the
snowman to raise his eyes.
• There are also methods that cause the snowman to turn and face to
other object, and move toward towards the object.
• getHeight() will return the bunny’s height from the properties value.
1
2 3) The new method (user-
define/editable) is appear in bunny
object
1) Give the appropriate method
name
2) Define some instructions
• When programmers execute a method, they commonly say that they are calling the method.
• When you call a method and provide any necessary arguments, it is called passing the
arguments to the method.
Arguments
• When the program performs these calculations, it stores their results in the
computer’s memory. When a program stores information in memory, it does so with
variables.
Operators Description
+ Addition
- Subtraction
* Multiplication
/ Division
Expression form :
Arguments / Parameters
• Using previous input example, set the bunny1’s height from the input data.
Parameter from
input data