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.
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);
}
}
Thanks for the tutorial this is very good