In this example we will show the method to return value in Java.
Source Code
package com.beginner.examples;
public class ReturnValue {
static String test(String s) {
return s; // return value
}
public static void main(String[] args) {
System.out.println(test("ok")); // call the method
}
}
Output:
ok