Monday, August 31, 2009

CONSTRUCTOR -> is a method that has the same name as the class name, used to initialize the fields in the object, do not return a value, not even using the void, can be 'overloaded Constructros' (constructor that can initialize another object of the 1 way).
The example constructor program

image below is a continuation of the above programs. If you want to see the picture more details, please click on the image to the two

It is the pattern of existing constructors in java programs. This is only a small part of other programs.

Saturday, August 29, 2009

Command or task means employment that must be carried out, learn java program will discuss some of the methods used by a programmer in a command and call if she needed. In this case the method given in words or simple phrases in order to facilitate the call.
The method is an order or a task that is called by the calling method, and there are methods that call himself.

METHOD -> Method is a command or specific tasks are called by the calling method (CALLER) and the results returned back to the calling method.
Common form or in the method declaration:
return-value-type method-name (parameter-list)
(
declarations and statements
)

method declaration information
* return-value-type is the type of data from the results that will be returned to the calling method.
* method-name is the name for a method.
* parameter-list is a list of parameter types and names.
* declarations and statements are information provided by the method.

Scope of the method declaration
* methods that served to change the value of the object into the given prefix set, for example setJariJari (). Name the method after the same set of data objects of variable names to be changed in value.
* method in charge to take the value of the object given the prefix get, for example getLuas (). Name the method after the word get together with a variable data object to be known values.
* methods in addition to serving as number 1 and 2 above will be named in accordance with the tasks undertaken by these methods.

The examples of methods of program

learn java in the program this time related to the recursive method and overloaded methods.

RECURSION -> (recursive method) -> recursive method is the method to call himself
The examples of recursive methods (calculating factorial)


METHOD OVERLOAD -> Some of the methods with the same name but different parameters (in terms of quantity, and type of parameters). When overloaded method is called java compiler will search for the parameters of which match the arguments of the calling method.
The examples of methods overload program

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Macys Printable Coupons