+ 3
Can't Java support standalone function without any class?
I recently noticed this trend that every method of Java should be enclosed in a class first then it can be used like a normal function Is it true??
3 odpowiedzi
+ 3
That is one of the reasons it is called a complete Object oriented programming language. Even the primitive data types have wrapper classes.
Everything has to be declared and defined within a class.
+ 3
The difference between a function and a method is that a function can be accessed from every part of the program, however a method can only accessed from a well defined class
Java doesn't support function so we will have to keep working with classes