Java Reference
In-Depth Information
Occasionally, a class defines two methods with the same name and different explicit
parameter types. For example, the PrintStream class defines a second method, also
called println , as
A method name is overloaded if a class has more than one method with the same
name (but different parameter types).
public void println(int output)
That method is used to print an integer value. We say that the println name is
overloaded because it refers to more than one method.
S ELF C HECK
9. What are the implicit parameters, explicit parameters, and return values
in the method call river.length() ?
10. What is the result of the call river.replace(ÐpÑ, ÐsÑ) ?
42
43
11. What is the result of the call greeting.replace(ÐWorldÑ,
ÐDaveÑ).length() ?
12. How is the toUpperCase method defined in the String class ?
2.5 Number Types
Java has separate types for integers and floating-point numbers. Integers are whole
numbers; floating-point numbers can have fractional parts. For example, 13 is an
integer and 1.3 is a floating-point number.
The double type denotes floating-point numbers that can have fractional parts.
The name Ȓfloating-pointȓ describes the representation of the number in the computer
as a sequence of the significant digits and an indication of the position of the decimal
point. For example, the numbers 13000, 1.3, 0.00013 all have the same decimal digits:
13. When a floating-point number is multiplied or divided by 10, only the position of
the decimal point changes; it Ȓfloatsȓ. This representation is related to the Ȓscientificȓ
Search WWH ::




Custom Search