9.
Why Java?
 cheap – almost all tools/softwares/components are available for
free!
 simple - partially modeled on C & C++ but greatly simplified and
improved (eliminates pointers, simplifies multiple inheritance,
etc.)
 object-oriented programming language
 any conceptual component in your problem can be represented as an object in
your program
 portable
 Java programs are compiled (translated) into the Java Virtual Machine (JVM)
code called bytecode
 bytecode is machine-independent and run on any machine with a Java
interpreter
 the Java interpreter (part of JVM) further translates the bytecode into the
machine language of the target machine
 once compiled programs can run on any platform (with JVM installed)
without being recompiled

16.
Tahap 3-5
 Phase 3: Loading a Program into Memory
 In Phase 3, the program must be placed in memory before it can
execute a process known as loading.
 The class loader takes the .class files containing the program's
bytecodes and transfers them to primary memory.
 The class loader also loads any of the .class files provided by Java
that our program uses.
 Phase 4: Bytecode Verification
 In Phase 4, as the classes are loaded, the bytecode verifier
examines their bytecodes to ensure that they are valid and do not
violate Java's security restrictions.
 Phase 5: Execution
 In Phase 5, the JVM executes the program's bytecodes, thus
performing the actions specified by the program.

30.
Shorcut Assignment Operators
Java memiliki 6 shortcut assignment operators:
Operator Name Description
= Assignment Assigns a new value to the variable
+= Addition Adds the operand to the starting variable value
of the variable and assigns the result to the
variable
-= Subtraction Subtracts the operand from the starting value of
the variable and assigns the result to the
variable
*= Multiplication Multiplies the operand by the starting value of
the variable and assigns the result to the
variable
/= Division Divides the operand by the starting value of the
variable and assigns the result to the variable
%= Modulus Derives the value that is left over after dividing
the right operand by the value in the variable,
and then assigns this value to the variable

37.
Ekspresi Boolean
 Ekpresi Boolean biasanya digunakan untuk mengatur control
statements.
 Ekpresi Boolean menghasilkan nilai true atau false.
 Ada 6 operator relational yang membandingkan operand
bertipe data primitif dan menghasilkan nilai boolean.
 Dalam suatu ekpresi boolean, suatu operand dapat berupa
literal, ekpresi aritmatika, maupun keyword true atau false.
Operator Name Description
== Equality Returns a true value if both operands are equals
!= Inequality Returns a true value if the left and right operands are not equal
> Greater Than Returns a true value if the left operand is greater than the right
operand
< Less Than Return a true value if the left operand is less than the right
operand
>= Greater Than Or Equal Returns a true value if the left operand is greater than or equal
to the right operand
<= Less Than or Equal Return a true value if the left operand is less than or equal to
the right operand

38.
Contoh ekpresi boolean
 discountPercent == 2.3 // equal to a numeric literal
 letter == ‘y’ // equal to a char literal
 isValid == false // equal to the false value
 subtotal != 0 // not equal to a numeric literal
 years > 0 // greater than a numeric literal
 i < months // less than a variable
 subtotal >= 500 // greater than or equal
to a numeric literal
 quantity <= reorderPoint // less than or equal to a variable
 Kita juga dapat menggabungkan beberapa nilai Boolean
dengan menggunakan operator AND dan OR:
Operator Name Example Description
&& AND a && b true if both a and b are true
|| OR a || b true if either a or b (or both) is true
^ XOR a ^ b true if only a or b is true
! NOT !a true if a is not true