return n;
}
public static long xMethod(long n) {
System.out.println(“long”);
return n;
}
}
#
7 When you invoke a method with a parameter, the value of the argument is
passed to the parameter. This is referred to as _________.
A. pass by name
B. pass by value
C. pass by reference
D. method invocation
#
8 Which of the following should be declared as a void method?
A. Write a method that returns a random integer from 1 to 100.
B. Write a method that prints integers from 1 to 100.
#
9 Each time a method is invoked, the system stores parameters and local
variables in an area of memory, known as _______, which stores elements in
last-in first-out fashion.
A. storage area
B. a heap
C. a stack
D. an array
#
10. What is the output of the following code?
public class Test {
public static void main(String[] args) {
System.out.println(m(“ABCDEFG”));
}
public static String m(String s) {