Onetop Master

Only available on StudyMode
  • Download(s) : 154
  • Published : January 8, 2013
Open Document
Text Preview
Chapter 3 Study Guide
Name: ____________________

1.In Java, methods must include all of the following except ___________.

a.a declaration

b.a call to another method

c.curly braces

d.a body

2.All method declarations contain ___________.

3.A public static method named computeSum() is located in classA. To call the method from within classB, use the statement ___________.

4.Which of the following method declarations is correct for a static method named displayFacts() if the method receives an int argument?

a.public static int displayFacts()

b.public void displayFacts(int data)

c.public static void displayFacts(int data)

d.Two of these are correct.

5.The method with the declaration public static int aMethod(double d) has a method type of ___________.

6.Which of the following is a correct call to a method declared as public static void aMethod(char code)?

a.void aMethod();

b.void aMethod(‘V’);

c.aMethod(char ‘M’);

d.aMethod(‘Q’);

7.A method is declared as public static void showResults(double d, int i). Which of the following is a correct method call?

a.showResults(double d, int i);

b.showResults(12.2, 67);

c.showResults(4, 99.7);

d.Two of these are correct.

8.The method with the declaration public static char procedure(double d) has a method type of ___________.

9.The method public static boolean testValue(int response) returns ___________.

10.Which of the following could be the last legally coded line of a method declared as public static int getVal(double sum)?

a.return;

b.return 77;

c.return 2.3;

d.Any of these could be the last coded line of the method.

The method cannot return nothing as in answer a, nor can it return a double as in answer c....
tracking img