137k views
4 votes
This type of method method performs a task and sends a value back to the code that called it:

A. Local
B. Void
C. Complex
D. Value-returning

User Claudeen
by
8.1k points

1 Answer

4 votes

Answer:

Option 4: Value-returning

Step-by-step explanation:

In programming, a method is a named section of codes that perform a specific task. This is possible to define a method that return a value after performing its task. This type of method is known as Value-returning method.

For example, we can define a method addition that takes two inputs, x, y and return the summation of x + y to the code that called it. The codes are as follows:

  1. public static void main(String[] args) {
  2. int sum = addition(3, 5);
  3. }
  4. public static int addition(int x, int y){
  5. return x + y;
  6. }

User Mevdschee
by
9.4k points