MethodsWithoutClass
DRAFT

Misconception:

One can have functions that are not members of a class. E.g., one could have a function int len(String s) and one could call that function like this: len("Hi").

Incorrect

Methods can be defined outside a class

Correct

Correction
Here is what's right.

Wrong: In Java all functions have to be members of a class (i.e., they have to be methods).

Language

Java

Concepts

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.