|
Page 9 of 14
Operators that work on only one operand are called unary operators. The
unary + operator is used to emphasize the sign of the operand, whereas
the unary - operator is used to arithmetically negate the value of the
operand. Both of these operators appear before the operand. For
example, +x -x......[read more]
The for loop is the most versatile looping construct. It is used to
continuously execute a block of code until a particular condition is
satisfied. It comprises three parts: initialization, condition, and
iteration. The initialization portion is generally an expression that
sets the value of......[read more]
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]
The bitwise OR operator is a binary operator that produces a 1 bit if
either of the bits in the operands is a 1. 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 outcome of the OR
operation when......[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]
The bitwise XOR operator is a binary operator that produces a 1 bit if
exactly one of its operands is 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 outcome......[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 equals() method checks if some other object passed to it as an
argument is equal to the object on which this method is invoked. The
default implementation of the equals() method is in the Object class,
the mother of all classes in Java. The equals() method in the Object
class checks if two......[read more]
The Double class is a type of wrapper class that wraps a primitive type
double value in an object. As the Double class is a subclass of the
abstract class Number, it implements the doubleValue(), floatValue(),
longValue(), and intValue() methods, which are declared as abstract in
the Number......[read more]
The instanceof operator is a binary operator that determines at runtime
whether its left operand is an instance of its right operand. Syntax:
obj instanceof type where, obj (the left operand) must be an instance
of a class and type (the right operand) may be a class, interface,
or......[read more]
|