xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create and call a method with parameter in Java
Java Online Editor
Execute Code
More Java Sample Codes
public class ExampleApp { public static void main(String[] args) { // Method with single parameter called String returnStringValue = methodReturnString("Hello from parameter"); // "Hello from parameter" is passed to the method as a parameter value. System.out.println(returnStringValue); // writing return value // Method with 2 parameter called int returnIntegerValue = methodReturnInteger(10, 20); // 10 and 20 are passed as parameter values of x and y. System.out.println("This method returns the sum of parameter values: " + returnIntegerValue); // writing return value } // Method with single parameter static String methodReturnString(String message) //String type parameter { return message; // message parameter value will be returned } // Method with two parameters static int methodReturnInteger(int x, int y) // x & y are integer type parameters { return x + y; // return value of parameters } }