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 return type in Java
Java Online Editor
Execute Code
More Java Sample Codes
public class ExampleApp { public static void main(String[] args) { // return string data String returnStringValue = methodReturnString(); // Calling the method. System.out.println(returnStringValue); // writing return value // return integer data int returnIntegerValue = methodReturnInteger(); // Calling the method. System.out.println("This method returns integer: " + returnIntegerValue); // writing return value } //This method returns String static String methodReturnString() { return "This method returns string data."; // return string } //This method returns integer static int methodReturnInteger() { return 10 + 11; // return integer } }