Operator on Integer and Separators in Java Programming
Operators on Integers in Java Programming are the arithmetic operators,assignment operators, relational operators, logical and bit wise operators almost every operator is used on integers in java.
operand + operand
// Add two literal values
int result = 5 + 5;
// Add two variables
int a = 5;
int b = 6;
int result = a + b;
// Add two variables and a literal
int result = a + b + 15;
Separators
Separators help define the structure of a program. The separator are used when we write a program. These following separator in java:
Separator | Name | Use |
. | Period | It is used to separate the package name from sub-package name & class name. It is also used to separate variable or method from its object or instance. |
, | Comma | It is used to separate the consecutive parameters in the method definition. It is also used to separate the consecutive variables of same type while declaration. |
; | Semicolon | It is used to terminate the statement in Java |
() | Parenthesis | This holds the list of parameters in method definition. Also used in control statements & type casting. |
{} | Braces | This is used to define the block/scope of code, class, methods.
|
[] | Brackets | It is used in array declaration. |