I would ask Why Not? Java is still one of the hot languages when it comes to Enterprise level Web apps, microservices and still dominates banking sector as well as Indian It market and definitely one of the toughtest language to learn considering the learning curve. If you are comparing Java with NodeJs, python, kotlin and Scala like languages, I would recommend you to go through latest releases of Java especially Java8,9,11,12 wherein they have not only optimized it but introduced features like functional programming, Java fibers, Webflux, Event handling, Nio etc just the thing is our market creates a hype and we follow that. We ignored python like this for a long time and now it is going to dominate the market soon. So what i would say is, have 3–4 programming languages in your bucket like Java, Python, ReactJs,Postgres etc and become a fullstack developer instead of focusing on one. CHEERS
Is it worth learning language X in year Y? It doesn’t matter. Once you learn a language like Java, you have learned all the other languages. You can learn Python in a day. You can learn C++ in a day, at least as much as you understand it in Java. Do not expect to have a comprehensive understanding of the full Java language, especially generics, but you don’t need a comprehensive understanding of any language. Besides, most of the interesting stuff is in knowing the libraries, essentially the “API” to the language. For example, I consider myself a pretty good Java programmer. It took me about four days to learn it well enough to program in it. But I have never tried to program a GUI in Java, because I have never needed to. All my work has been in doing classes and subclasses, abstract classes and concrete subclasses, writing some simple generic functions, and using fundamental data structures like arrays, lists, sets, and hashtables. Around 2003 I taught a network course using Java, and we created programs that could communicate over the Internet. It took me two days to learn Java Sockets, but then, I knew how to do socket programming already.
You lose nothing by learning Java, and gain a lot. I could say the same thing about C++, C#, Python, F#, Visual Basic, or even C. If you are really good at predicting the future, you could probably focus on the ideal language for your first or next job, but unless you have the full CTP implemented in your network stack, you probably won’t get it right (The Clairvoyance Transfer Protocol). But if you learn Java, or C++, or C#, or Python, you will have a selection of jobs available. And take this as a given: if you are just starting out, be prepared to learn a dozen new languages in your career. I have lost count of the languages I know, or knew. I have written fairly large programs in assembly code on a variety of platforms (this was in the days before C existed, and sometimes well after). I can take a piece of assembly code for a machine I never heard of, for which I don’t have the manual, and without much effort tell you what it is doing. Why? Because, deep in their silicon hearts, all computers are the same. The syntax of assembly code varies, the binary representations are all specialized, but once you’ve done one machine you have learned them all. Back in 1967, when I met my first IBM/360, I had already programmed three different machines in assembly code. I told the professor who taught the course that I thought the assignment was boring (I had already written a program to do it), and I wanted to write a compiler. He let me do it, and I got something like an A++++ for that course. I could put a program in, my compiler was a compiler for a simple variant of Algol-60, and within three weeks I was emitting source code which I could then compile and execute. There is no skill you can learn that will not benefit you. What you need to learn is not how to program in language X, but how language X embodies the principles of language design. Knowing data structures and algorithms is language-independent. Some languages, like Java and C++, have rich library features such as hash tables, multidimensional arrays, sets, queues, and stacks, but once you know what these structures are for, you don’t need to know the details of how you create them in language X, or find the language X libraries that do these things; you know what you want, you know what to expect, and you know how to use Google to get the online documentation for language X, the StackOverflow boards where people discuss language X, and those skills will always be powerful. Far more powerful than knowing the syntactic features of a language. Syntax is nothing. It’s all the same. Libraries are where the action is, and once you have built a GUI on one machine in one language, you are prepared to build a GUI on any machine in any language. Stop thinking in the “trade school” model and start thinking like a scientist: understand the basic principles and you understand pretty much everything there is to know about any language.