fbpx

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

1
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);


}

}

Thando Gama

One thought on “How to create a method in java which returns a value 2020

Leave a Reply

Your email address will not be published. Required fields are marked *

Next Post

Isibaya 24 June 2020 : Phumelele tells her children about the divorce

Wed Jun 24 , 2020
Spread the love           Isibaya 24 June 2020 : Phumelele tells her children about the divorce. She told Thokozani that the only thing she is most worried about is her kids which meant the was talking about Melusi and Thokozani. Isibaya 24 June 2020 : Phumelele tells her children about the divorce […]
Isibaya 24 June 2020 : Phumelele tells her children about the divorce. She told Thokozani that the only thing she is most worried about is her kids which meant the was talking about Melusi and Thokozani.