Home SportHow to create a method in java which returns a value 2020

How to create a method in java which returns a value 2020

by Thando Gama
How to create a method in java which returns a value 2020
Spread the love

How to create a method in java which returns a value 2020.

A Java method is a collection of statements that are grouped together to perform an operation.

https://www.youtube.com/watch?v=nJAIN5O9Xjc

How to create a method in java which returns a value 2020

below is the code just copy and paste in your class but you have to change the class name to tour own.

package javalessons;

public class Javalessons {
//Method
public int addtwonumbers(int num1, int num2){
int total = num1 / num2;
System.out.print(total);

   return total;

}

public static void main(String[] args) {

    Javalessons n = new Javalessons();

    n.addtwonumbers(200, 5);


}

}

Related Articles

1 comment

Gama 13/08/2020 - 1:51 pm

Thanks for the tutorial this is very good

Leave a Comment