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.

عرض المثال

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

← العودة إلى الدورة