Skip to content

Methods

Definition

// Create a function that prints "Hi" and returns 0
public int hello() { // Creates a function with the function signature hello()
    System.out.println("Hi!");
    return 0; // Function signature enforces the specified return value. 
}

Function definition follows the following syntax: <visibility> <return_type> <name>(<args>) { <body> }