Non static methods, belong to instance of class.
Static methods, belong to class.
Functions, do not belong to class. Is it correct to day that they are just used to perform some task which may have not relation to the class ?
Is there something in java which is like functions of Python?
I don't know if it's a formal definition, but a procedure. also known as a subroutine is a callable unit of code that is not associated with any object. A function is a subroutine that returns a result and is likewise not associated with any object. A method is a procedure or function that is bound to an object instance (instance method) or class (static method).
These are the common terms, they may vary for different language environments and IT shops or schools.
Two of the most common types of programming languages are the procedural languages, such as Fortran, COBOL, Pascal, and so forth, and the Object-oriented languages, such as Java and C++.
C++ can be used either procedurally or OOP or both. Java can only be OOP, so I'd argue that a more accurate term for Java would not be object-oriented, but object-based. But generally people think of it as OOP.
Python started as a procedural language, but various hacks have been added to it to allow it to support OOP-style programming. I'd say that it's less OOP than C++. because I find that C++ has more of the syntactic sugar to simplify code than Python — I cannot count the number of times in Python I've burned myself for not prefixing an identifier with "self" where "this" would be optional in C++. But there you have it.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Campbell Ritchie wrote:Java® was designed specifically as an object‑oriented language. That is why it doesn't support methods outwith classes (or more precisely didn't before default methods in Java8).