Tampilkan postingan dengan label Object Oriented Programming(OOP). Tampilkan semua postingan
Tampilkan postingan dengan label Object Oriented Programming(OOP). Tampilkan semua postingan

Minggu, 17 Maret 2013

Posted by Kiki Risky | File under : , ,
Repetition For

As in the previous loop structure code execution repeating several times.

The form of the for loop,

for (InitExpression; LoopCondition; StepExpression) {
statement1;

Another way to create a branching is to use
switch keyword. By using a switch we can do
branching with diverse requirements.

Shape switch,

switch (switch_expression) {
case_selection1 case:
statement1; / / block 1
break;
case_selection2 case:
statement1; / / block 2
break;
default:
statement1; / / block n
break;
}

Posted by Kiki Risky | File under : , ,
Statement on else part of the if-else block can be another if else structure. Such structures allow us to make the selection more complex requirements.

Forms of if-else if,

if (boolean_expression1)
statement1;
else if (boolean_expression2)
statement2;

If-else structure is used when we want to execute a statement with a condition statement true and others false conditions.

The form of the if-else,

if (boolean_expression)
statement;
else
statement;




For more than one line,

Structure determines if a statement (or a block statement) that
will be executed if and only if the requirements of boolean (boolean statement) is true.

Shape if the first line of the statement,

if (boolean_expression)
statement;

 

The form if more than one line statement,

if (boolean_expression) {
statement1;
statement2;
}

Posted by Kiki Risky | File under : , ,
The variable is a place in memory that is allocated to hold data that has a temporary nature, which is used only when the program is still running and removed / deleted from memory after the program ends.

Declaration Format:
TipeData namaVariabel [= inisialisasiNilaiAwal];

example:
int nilaiAbsen;
int nilaiTugas, nilaiUTS, nilaiUAS;
String firstName = "Tariq"
NamaTengah String = "Athar", LastName = "Kisan";
nilaiHuruf char = 'A';


Posted by Kiki Risky | File under : ,
 Showing Results in Screen Monitor

To display the results to the screen can be done with a few commands, such as:

A. Console environment
using the method print () or println () in the class system in the java.lang package structure. This package is the default package for all java apps, so it does not need to be imported into the program.

B. Using the GUI components
using JOptionPane class that is a component of the package javax.swing. Both the output and the input (showMesageDialog () or showInputDialog ()).



 Reading Data From Keyboard Input

 To display the results to the screen can be done with a few commands, such as:

 A.Console environment
using the method print () or println () in the class system in the java.lang package structure. This package is the default package for all java apps, so it does not need to be imported into the program.

B.Using the GUI components
using JOptionPane class that is a component of the package javax.swing. Both the output and the input (showMesageDialog () or showInputDialog ()).


Posted by Kiki Risky | File under : ,
 Creating objects of a Class

To create a new operator takes an object. The shape is generally as follows:

namaKelas namaKelas namaObjek = new ();


example:

ObjMahasiswa student = new Student ();


 Accessing Data and Methods of a Class

 To access the data and the method on an object can be done in the following way:

namaObjek.namaVariabel;
namaObjek.namaMethod ();

That needs to access the data and methods is how to set the level of accessibility (accesibility level) the two elements of the class that access, whether the default, public, private, or protected.

example:

objMahasiswa.NIM;
objMahasiswa.bayarKuliah ();

Sabtu, 16 Maret 2013

Posted by Kiki Risky | File under : ,
  1. Object is a unitary entity (object), either in the form of real and unreal objectives such as system or concept that has characteristics and properties of the function.
    Examples: cake, markers, cars, phones, etc.
  2.  The class is modeling of the object that contains information (rules) of the characteristic properties (data) and behaviors (methods) that are owned by the object.
    Examples: cake recipe, material markers, etc.
  3.   Instance is the embodiment, which in terms of programming, an object is an instance (manifestation) of a class. Instantiation is: the embodiment of a class of objects. Usually within the Java programming using the new command.