Java Reference
In-Depth Information
25.
-14 20 126
15 40 407
15 80 1627
70 160 6412
27.
a.
Take Programming I.
b.
Take Programming II.
c.
Take Invalid input. You must enter a 1 or 2
d.
Take Invalid input. You must enter a 1 or 2
29.
Identifier
Visibility in
traceMe
Visibility in
main
main
Y
Y
local variables of
main
N
Y
traceMe
(function name)
Y
Y
x
(
traceMe
's formal parameter)
Y
N
y
(
traceMe
's formal parameter)
Y
N
z
(
traceMe
's local variable)
Y
N
31.
public static void
func(
double
x,
double
y)
{
if
(x != 0)
System.out.println(y / x);
else
System.out.println("Because the first number is 0, "
+ "we cannot divide the second "
+ "number by the first number.");
}
Chapter 8
1. a. False; b. False; c. True; d. False; e. False
3. Constructors have no type. Therefore the definition of
the constructor with
parameters should be:
public
AA(
int
a,
int
b)
{
x = a;
y = b;
}
Search WWH ::
Custom Search