|
Page 7 of 9
Variables holding the reference to an object are called reference
variables. The initial value of a reference variable depends on its
place of declaration. Class variables and instance variables are
initialized with a special null value, whereas variables declared
inside code blocks are not... [read more..]
Numeric values having no decimal parts are called integer literals.
These values can be expressed in decimal, octal, and hexadecimal forms.
By default, integer literals are in decimal form. The decimal form
contains a sequence of decimal digits (0 to 9), the octal form contains
a sequence of... [read more..]
An abstract class is a class that is partially implemented. It provides
design convenience. An abstract class consists of one or more abstract
methods that are declared but left unimplemented. It is the
responsibility of subclasses that extend an abstract class to implement
the unimplemented part... [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..]
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..]
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..]
As soon as an array is created using a new operator, its elements are
automatically initialized to their default values. This automatic
initialization of the elements depends on the data type of the array.
The table given below shows the initial value of the elements of an
array: Element... [read more..]
The if-else statement is a conditional statement. It is used to execute
a statement or group of statements based on some condition. The general
format of the statement is given below: if(boolean_expression)
{statements;} else {statements;} The... [read more..]
|