|
Page 10 of 14
The bitwise AND operator is a binary operator that produces a 1 bit if
both of the bits in the operands are 1. Otherwise, it produces a 0 bit.
It is denoted by the symbol &. It can be applied to the integer
type operands, i.e., byte, short, char, int, and long. The table given
below shows the......[read more]
The increment operator is a unary operator that increases the value of
its operand by one. For example, the expression a++ increases the value
of a by 1. This statement is equivalent to the expression a = a + 1 .
The increment operator can be used in either of the two forms given
below:......[read more]
There are two forms of assignment operators used in expressions. The
first one is called the simple assignment operator and the other one is
called the compound assignment operator. Simple assignment operator:
The simple assignment operator assigns the left operand with the value
of the......[read more]
The modulus operator is a binary arithmetic operator that returns the
remainder of the division operation. It can be used with both
floating-point values and integer values. The use of the modulus
operator is shown as follows: opL % opR where, opL is the left operand
and opR is the right......[read more]
Packages are declared by using the package statement. The word package
is a keyword in Java. The package statement is not technically needed
to write a complete Java program. However, if it appears, it must be
the first executable statement in the program. Only comments or white
spaces are......[read more]
Variables that have only one copy per class are known as static
variables. They are not attached to a particular instance of a class
but rather belong to a class as a whole. They are declared by using the
static keyword as a modifier. For example: static type varIdentifier;
where, the......[read more]
When a sequence of statements are put inside the curly braces, they
form a block. A block is a Java language feature that allows a
programmer to execute multiple lines of code at a time. A block is
executed by executing all the statements within the braces in the order
from first to last. If......[read more]
Variables declared within blocks (i.e., inside braces) are known as
local variables. They are so called because they are not available for
use outside the block where they are declared. These variables are
temporary variables, which are visible to the program only within the
scope of the block.......[read more]
The import statement is a compilation unit that is used to bring a
specified class, or an entire package, into the visibility of a source
file. The import statement is an optional part of a source file. If the
import statements appear in a source file, they must be placed before
any class......[read more]
The round() method is a static method of the java.lang.Math class. It
takes a floating-point number as an argument and returns an integer
representation of the number. The value returned by the round() method
is the same as the value returned by the Math.floor() method in the
following......[read more]
|