≡ Menu

Operasi Dasar Java

Java logo

Arithmetic Operators

Operator Description
+ Addition operator – Adds operands on both sides of the operator
Subtraction operator – Subtracts the right hand operand from the left hand operand
* Multiplication operator – Multiplies operands on both sides of the operator
/ Division operator – Divides the left hand operand by the right hand operand
% Modulus operator – Divides the left hand operand by the right hand operand and returns remainder
++ Increment operator – Increases the value of operand by 1
Decrement operator – Decreases the value of operand by 1

Relational Operators

Operator Description
== Checks if the values of the two operands are equal or not, if yes then the condition becomes true.
!= Checks if the values of the two operands are equal or not, if values are not equal then the condition becomes true
> Checks if the value of the left operand is greater than the value of the right operand, if yes then the condition becomes true.
< Checks if the value of the left operand is less than the value of the right operand, if yes then the condition becomes true.
>= Checks if the value of the left operand is greater than or equal to the value of the right operand, if yes then the condition becomes true.
<= Checks if the value of the left operand is less than or equal to the value of the right operand, if yes then the condition becomes true.

Logical Operators

Operator Description
&& AND Operator. If both boolean operands are true, the condition becomes true
|| OR Operator. If any of the boolean operands is true, the condition becomes true
! NOT Operator. Reverses the value of a boolean operand

Assignment Operator

Operator Description
= Simple assignment operator. It assigns values from right side operands to left side operand
{ 2 comments… add one }
  • Nurul nisa March 28, 2018, 1:08 pm

    What is the meaning of logical operation?

    • Nadiar AS May 2, 2018, 11:49 am

      logical operation, simpelnya operasi yang return valuenya berupa boolean.

Leave a Comment