Answers for "how to declare function in java"

1

function in java

public class Main
{
    static void function(){
        System.out.println("I am a function!");
    }
	public static void main(String[] args) {
		function();
	}
}
Posted by: Guest on March-30-2020
3

java methods

public class MyClass {
  static int myMethod(int x) {
    return 5 + x;
  }

  public static void main(String[] args) {
    System.out.println(myMethod(3));
  }
}
// Returns 8
Posted by: Guest on June-02-2020
1

declare function in java

static void myMethod() {
    //LINES OF CODE
  }
Posted by: Guest on January-21-2021

Code answers related to "how to declare function in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language