java-01
java-01
➢ Local variables
➢ Instance variables or Member variables or Global variables
➢ Static variables or Class variables
➢ Final variables
10
Local variables
🔔 The addition operator can be used with numerical data types and character or string data type. When it is used with numerical
values, it performs mathematical addition and when it is used with character or string data type values, it performs concatenation
(appending).
🔔 The modulus (remainder of the division) operator is used with integer data type only.
🔔 The increment and decrement operators are used as pre-increment or pre-decrement and post-increment or post-decrement.
🔔 When they are used as pre, the value is get modified before it is used in the actual expression and when it is used as post, the value
is get modified after the actual expression evaluation.
16
17
Relational Operators (<, >, <=, >=, ==, !=)
The relational operators are the symbols that are used to compare two values. That means the
relational operators are used to check the relationship between two values. Every relational operator
has two possible results either TRUE or FALSE. In simple words, the relational operators are used to
define conditions in a program. The following table provides information about relational operators.
18
19
Logical Operators
The logical operators are the symbols that are used to combine multiple conditions into
one condition. The following table provides information about logical operators.
🔔 The operators &, |, and ^ can be used with both Boolean and integer data type values. When they are used with
integers, performs bitwise operations and with Boolean, performs logical operations.
🔔 Logical operators and Short-circuit operators both are similar, but in case of short-circuit operators once the
decision is finalized it does not evaluate remaining expressions.
20
21
Assignment Operators
The assignment operators are used to assign right-hand side value (R-value) to the left-hand side variable (Value). The
assignment operator is used in different variants along with arithmetic operators. The following table describes all the
assignment operators in the java programming language.
22
23
Bitwise Operators
The bitwise operators are used to perform bit-level operations in the java programming language.
When we use the bitwise operators, the operations are performed based on binary values..
Let us consider two variables A and B as A = 25 (11001) and B = 20 (10100).
24
25
Conditional Operators