Wednesday, July 29, 2009

FOR -> is a keyword that is used to perform iteration with a digit numeric selection, in the form of integer or fractional.
syntax
for(value_first; limit; changes )
{//statement to be run}
in the code that appears to be filled with the original values and create a variable filled with the beginning of the process. To limit the content of the iteration limit, and the change is a value that changes the value of var to be the limit. Before running the program reached the limit statement in the for block.
Example For Increment
Description
The first value of i = 0, and then checked whether i <4 i =" 1"> 4 or i value false.


Example For Decrement
Description
almost the same as for increment, the value i only just started i = 3 or change the value of the decrement decrease.


Description of the road program in detail












Example of printing the program genap











Example of printing the program ganjil

Saturday, July 25, 2009

This is a string class
where the data type of standard java to process the data string.
in C / C + +

CLASS STRING -> String is not the type of data standard java, java instead provide String Class And Stringbuffer Class to process the data string.
in C / C + +, a data string in represantasikan with 2 ways:
1. Array-of-char: memendang data as a series string of characters that form the array, the array element is certain and can not be changed.
2. Pointer-of-char: make the data as a string of linked-LIST series of data characters, is more with the long dimanis can change.

Java adopt both the concept with the above two classes which handle the data string. Namely CLASS STRING (Array-of-char) and CLASS STRINGBUFFER (Pointer-char-of).

example of writing a string class
namely with the sign ( ") beginning and end of string.
example
"Indonesia"

Variables with type string is the variable that is used to store string data. Java provides a type of data in the form of a string class, open form of data types such as int, double and char. Through this class string we can do more to process the data string, for example, conversion of data into a string data type.

Object variable declarations declare variables as usual, as follows:
String nama_objek;

Initialization string
-> There are 3 ways to the string variable bertipe class
1. 1 initialization:
String abc = new String ( "initialisation example 1");
2. Initialisation 2:
String abc;
...
abc = new String (initialisation example 2 ");
3. Initialisation 3:
String abc;
...
abc = "initialisation 3";

Example program class string

Saturday, July 18, 2009

Now we start to go about if and switch, learn java in the previous program we at least understand a little about if and switch. Here, there is little understanding of if and switch, although not so much but it is important for you to try the program before java is, at least at a glance, read with understanding what you can and if that switch. Welcome to try in learnjavaprogram

IF -> structure which only execute the activities that result in a boolean value true
syntax
if(boolean_expr);
or
if(boolean_expr) statement;
example:
if(grade > 70)
System.out.println("Passed");

**if/else is statement executed if the value of boolean expression true value and execute the statement that when expresinya boolean value is false. But if using / false
syntax
if(boolean_expr)
statement 1;
else
statement 2;
example
if((b*b-4.a*c)>=0.)
(System.out.println(“there are real roots”);
else
System.out.println(“there are complex roots”);

**Usually in programming options can be found once the complex. so if the / else if it is found that complex if / else can be sintak with the following;
syntax







example

if ( (b*b – 4. *a*c) >= 0. )
System.out.println(“there are real roots”);
else if((b*b-4.*a*c)==0.)
System.out.println("there are two identical real roots");
else
System.out.println(“there are complex roots”);

**if stratified is if the selection could have if, instead of false can have the false
syntax












**structure condition is operator for the condition of the structure with the mark (?:) is an equality if / else
structure
example:
System.out.println(grade>70?"passed":"Failed")


SWITCH -> One of the selection of the structure, the program will read the blocks in accordance with the values listed in an expression.
syntax

















information SWITCH
case is a switch statement that can be used for the selection process with a single variable that are, the core of the switch case itself is the selection process but which are only one variable in the SWITCH keyword, and there are several options in the keyword CASE.

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