Java Reference
In-Depth Information
13. a.
4;
b.
26;
c.
10 4 0;
d.
0
15. a.
14;
b.
15;
c.
30
17. A
void
method can have a
return
statement. If a
void
method has a
return
statement, then it must be of the form
return
;
, it should not return any value.
19.
12
35
14
8
10
21.
1
2
6
24
120
23. Method headings:
public static void
main(String[] args)
public static void
hello(
int
first,
double
second,
char
ch)
Method bodies:
main:
starts at Line 4 ends at Line 13
hello:
starts at Line 16 ends at Line 20
Method definitions:
main:
starts at Line 3 ends at Line 13
hello:
starts at Line 14 ends at Line 20
Formal parameters:
main: args
hello: first, second, ch
Actual parameters:
x, y, z
x + 2, y - 3.5, 'S'
Method calls: Statements in Lines 9 and 11
hello(x, y, z);
//Line 9
hello(x + 2, y - 3.5, 'S');
//Line 11
Local variables:
main: x, y, z
hello: num, y
Search WWH ::
Custom Search