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.

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

Leave a Reply

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

Next Post

Secrets revealed why Kaizer Chiefs is the Manchester city of SA

Mon Sep 30 , 2019
Spread the love           Secrets revealed why Kaizer Chiefs is the Manchester City of SA. Kaizer Chiefs have collected 16 points in seven Absa Premiership matches.The Amakhosi  have set a blistering pace as they seek a first top flight title in 4 years and it is one of their manager Ernst Middendorp […]
Kaizerchiefs

Celebrity News