Java MT 4

The flashcards below were created by user gianni11 on FreezingBlue Flashcards.

  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.
  4. ______ means a method belongs to a class not a specific object.
  5. What is void?
    a method that simply performs a task and then terminates.

  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;

  7. When does a method execute?
    when its called by a statement

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


    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.
  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.
Card Set
Java MT 4
MT 4
Show Answers