Java MT 4

Card Set Information

Author:
gianni11
ID:
207402
Filename:
Java MT 4
Updated:
2013-03-15 01:17:07
Tags:
MT
Folders:

Description:
MT 4
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user gianni11 on FreezingBlue Flashcards. What would you like to do?


  1. How is the header of a method defined?
    public static void displayMesssage() {
  2. How is the body of a method defined?
    • System.out.println("Hello");
    • }
  3. The method body is a collection of _________ that are performed when the method is executed.
    statements
  4. ______ means a method belongs to a class not a specific object.
    static
  5. What is void?
    a method that simply performs a task and then terminates.

    System.out.println("Hi!");
  6. what is a value-returning method?
    not only performs a task, but also sends a value back to the code that called it.

    int hours;

    hours=Integer.parseInt("70");
  7. When does a method execute?
    when its called by a statement

    displayMessage();
  8. What is a method modifier?
    public static    void displayMessage ()
  9. Values that are sent into a method are called ____________
    arguments

    System.out.println("Hello");

    number = Integer.parseInt(str);
  10. The _______ of an argument in a method call must correspond to the variable declaration in the parentheses of the method declaration.

    number = Integer.parseInt(str);
    data type
  11. The ____________ is the variable that holds the value being passed into a method.
    parameter
  12. How are arguments passed into a method?
    showSum(5, 10);

    public static void showSum(double num1, double num2)

    double sum; //to hold the sum

    sum = num1 + num2;

    System.out.println("The sum is " + sum);
  13. How is a value from a method returned?
    public static int sum(int num1, int num2)

    int result;

    result = num1 + num2;

    return result;
  14. The return statement causes the method to end execution and
    returns a value back to the statement that called the method.

What would you like to do?

Home > Flashcards > Print Preview