Sunday, August 16, 2009

Then learn java program will continue to start Array is a variable declaration in the java program, which makes it easier for a programmer in a program.

ARRAY -> Array is a solution to declare a number of variable appropriately. Use an array of variables to save time pronouncing the name variable. Array variable is a number of variables with the same name.
Illustrasi Array:
Index data






notes
: No.Indeks / beginning No.Element number 0 (zero) and end n-1 where n = number of data.


DECLARE VARIABLE ARRAY
General form:
Data Type [] Variablename [= new datatype [number of elements]]

Some way declare an array variable:
1. Without mentioning some of the required number of elements
int [] numbers;
In the example above variable number can not be (fill in) before a number of elements or ordered before the reservation. So that should be written under the command like this:
number = new int [5];
2. With the number of elements that are required
int [] numbers = new int [5];
Keep in mind, how the above data is done manually with the input one-one.
3. With the automatic method
number of elements not explicitly shown can still be seen from the data that is defined sacara regularly.
int number = (3,5,7,1,10);

Calculating Number of Array Elements:
Java provides a function or method to calculate the number of elements that have a variable array in the function "length".
WRITING FORMAT AS NEXT
Name_Variable_ArrayLength

example
System.out.println ( "number of elements in the array variable is a number:" + number.length);
Sample Program initialisation-Element Array Element

Output or Results
notes : picture on the side of the program is the result of the above, where the above program using JCreator pro (JAVA)

Monday, August 10, 2009

OK .... now we will start again in learnjavaprogram. This time related to the keyword while. Keyword in the previous 2 while there are:
While and Do-While

WHILE -> the process of looping with a particular selection, where during the process of looping the loop true value will continue to run.
syntax









See above there is a (var_selection), a variable that will hold the selection in the loop when walking. During var_selection values is correct, then in block akan While the execution.
The Example Program WHILE


















Control Structure WHILE

DO-WHILE -> looping process used is at least 1 time the localization.
syntax










statement in the block Do-While dikerjakan first time, and after that selection occurs in the keyword while. TRUE if the statement will then be reset, otherwise if FALSE exit from the loop.
The Example Program DO-While


























Control Structure DO-While

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