You are on page 1of 12

Operator

TIM DOSEN IMPLEMENTASI


ALGORITMA
Operator
1. Arithmetic operator
2. Relational operator
3. Logical operator
4. Conditional operator
Arithmetic Operator
1. Operan : Numerik, [String]

2. Output : Numerik, [String]


Relational Operator
1. Operan : Numerik, karakter, string.

2. Output : Boolean.
Logical Operator
1. Operan : Boolean.

2. Output : Boolean.

3. Jenis
a. && (logical AND)
b. & (boolean logical AND)
c. || (logical OR)
d. | (boolean logical inclusive OR)
e. ^ (boolean logical exclusive OR)
f. ! (logical NOT)
Tabel Kebenaran
AND True False OR True False
True True False True True True
False False False False True False

XOR True False NOT True


True False True True False
False True False False True
Operator Precedence
Operator Precedence
Berikut ini terdapat ekspresi yang kompleks,
(6%(2*5))+(4/((2+88)-10)
6+(4/(80)
ekspresi di atas dapat ditulis ulang ddengan memberikan tanda kurung berdasarkan prioritas
operator
Runutan (sekuensial)
Alur eksekusi program  dijalankan dari atas ke bawah, sesuai urutan baris, kecuali terdapat
perintah untuk melakukan percabangan atau perulangan.

Contoh :
◦ Alur resep masakan
◦ Alur prosedur operasi
◦ Alur prosedur registrasi
◦ Alur program juga sama….
Dry Run
Melakukan proses debug terhadap alur program.

Melihat perubahan nilai pada program.

Dilaksanakan per-baris aksi/statement


Dry Run
int A=1, B, C=10;
A = 10; Baris A B C
B = 12; 1 1 0 10
A = B; 2 10 0 10

C = B + A; 3 10 12 10
4 12 12 10
System.out.println(A);
5 12 12 24
B=input.nextIn()// input 4
6 12 12 24
7 12 4 24
Daftar Pustaka
1. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to Algorithms Third
Edition. Cambridge: The MIT Press.

2. Sedgewick, R. (2002). Algorithm in Java: parts 1-4 Third Edition. Boston: Pearson Education, Inc.

3. P. Deitel and H. Deitel, Java How To Program 9th Edition, Prentice Hall, 2011.

4. Poo, Danny, Derek Kiong, and Swarnalatha Ashok. Object-Oriented Programming and Java, 2nd
Edition. Springer, 2010.

5. Wu, C. Thomas. An Introduction to Object-Oriented Programming with Java. McGraw-Hill, 2009.

You might also like