Java Reference
In-Depth Information
6 . To use a predefined method in a program, you need to know the name of the
class containing the method (unless the class, such as the class String ,is
automatically imported) and the name of the package containing the class ,
and then you need to import the class into the program. In addition, you
need to know the name of the method, the number of parameters the method
takes, and the type of each parameter. You must also be aware of the method's
return type or, loosely speaking, what the method produces.
7 . In Java, the dot (.) is called the member access operator. The dot separates the
class name from the member, or method, name. Dot notation is also used
when a reference variable of a class type accesses a member of that class .
8 . The class String is used to process strings.
9 . The assignment operator is defined for the class String .
10 . The method substring of the class String returns a substring from
another string.
11 . The class String contains many other useful methods, such as: charAt ,
indexOf , concat , length , replace , toLowerCase , and toUpperCase .
12 . You can use the method printf to format the output in a specific manner.
13 . A format
specifier for general, character, and numeric types has
the
following syntax:
%[argument_index$][flags][width][.precision]conversion
The expressions in square brackets are optional. The required conversion
is a character indicating how the argument should be formatted.
14 . The method printf is available in Java 5.0 and its higher versions.
15 . In a format specifier, using the option width you can also specify the
number of columns to be used to output the value of an expression. The
(default) output is right justified.
16 . In a format specifier, if the number of columns in the option width is less
than the number of columns required to output the value of the expression,
the output is expanded to the required number of columns. That is, the
output is not truncated.
17 . To force the output to be left justified, you use the format specifier flag. If
the flag is set to '-' , then the output of the result is left justified.
18 . A numeric string consists of an integer or a decimal number with an optional
minus sign.
19 . To convert a numeric integer string into an integer, you use the expression:
Integer.parseInt(strExpression)
where strExpression is an expression containing a numeric integer string.
20 . To convert a numeric decimal string into a double value, you use the
expression:
Search WWH ::




Custom Search