I did some research online, people have different explanations for that (e.g. coding style, side effects, etc.) which make me a little confused. I also did some Spark programming with Scala. Scala and Java programming has a lot similarities, but Scala is considered as also a functional programming language, even though it is even more object oriented than Java. I know Java supports functional programming only to a limited extent, but to what level it can be called a functional programming?
You will have to ask James Gosling, who is the one person to know all that sort of thing, but:-
1: Please find out how much of a “mainstream” paradigm functional programming was in the mid‑1990s. The language was designed with current thinking in mind, and the big paradigm then was object‑orientation.
2: The original design of Java® was influenced by languages current at the time, Simula‑67, C++, SmallTalk, Eiffel, etc., as well as concepts like those in Object‑Oriented Software Construction by Bertrand Meyer.
3: It took several years to remedy some of the shortcomings of early versions of Java®, e.g. lack of assertions, lack of generics.
4: By the end of the 2010s, Java® was looking very old‑fashioned both because of its extreme imperative style, and because it requires no slight effort to adapt a program for a multi‑core processor.
5: The Streams API introduced in Java8 allows one to use a more declarative style, and also accommodates itself to multi‑core processors almost effortlessly.
6: The λ expression allows one to write much simpler code than the old anonymous class, and that is a functional feature.
7: Pierre-Yves Saumont, who is an occasional user of this website, says that any language can be used in a functional styl, and has a book published by Manning about writing functional code in Java®. His writings give me the impession that functional coding isn't so much, “what you call it,” as, “what you do with it.”
Thank you very much for your answer! This is the reason why I love this site, I asked a shallow and immature question, and you answered it much deeper with a lot more information I would like to know and learn. If this is on Stackoverflow, they may crazily vote my question down and close it.
I would like to give you ten cows 🐄🐄🐄🐄🐄🐄🐄🐄🐄🐄 if I can!
Functional programming dates all the way back to LISP, which puts it in the same era as the venerable FORTRAN and COBOL programming languages. So it wasn't new technology by the 1990s. And OOP wasn't even radically new by then. C++ was announced to the public in 1985 and I'd been marketing a C++ development system myself for several years before Java came out. In fact, had developed a Smalltalk system written in C++.
Gosling wanted something like C++ but friendlier, safer, more secure and without the dead weight of C and that's what he developed. So that was Java. These days we like the functional paradigm since it's stateless and that scales well across multiple distributed servers, which wasn't a common problem back then.
I'm not sure about the assertion that Java requires major recoding to support multi-core processors. Unless that's supposed to mean that you have to explicitly construct and manage java Threads whereas some of the more popular languages of the day deal with that more automatically. A thread doesn't care whether it's on one core or processor or many. Which, of course, is different than processes running on multiple hosts!
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
Regarding Scala, it's considered a mixed-paradigm language, supporting both functional and object-oriented styles. It supports more functional features than Java, especially when it came out well before Java adopted lambdas... but it's also possible to write very non-functional code if you want in Scala. Much like Java.