Starlit Daily

📚 › Java

4. Methods

A method is a named block of code inside a class. Declare the return type, the name and the parameter types. static methods can be called without creating an object.

Show example

static int twice(int x) {
  return x * 2;
}

← Back to course