xFactorSchool.com
Python
JavaScript
How to Do Examples
C 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 Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
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 } }