basics of function in java code example
Example 1: how to create a function in java
package com.company;
public class Main {
static void one(){ // youCanPutWhatEverNameYouLikeInThePlaceOf"One"
System.out.println("HELLO");
}
public static void main(String[] args) {
one(); //theTerminalShouldSay"HELLO"
}
}
Example 2: java how to define a function
//declare a function like this:
void function(int parameter1)
{
//function body
}
//call the function like this:
function(1);