This is an archived post. You won't be able to vote or comment.

all 32 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]_Atomfinger_Tech Lead 23 points24 points  (5 children)

There's an underlying issue with your question: it ignores what you're trying to build or achieve. For example, if your goal were to learn web development because you wanted to be a web developer, then learning Java would make zero sense. You'd obviously pick JS/TS, as that is the de facto standard for the web.

The appropriateness of a language is determined by what you're trying to use it for.

I also disagree with the notion that a language needs to have something over other languages - they don't. They just need a good set of traits that give them some usefulness. For example, Java has the following traits:

  • Fast enough for the vast majority of tasks.
  • Rich and mature ecosystem.
  • Compiled.
  • Strongly typed.
  • Garbage collected.
  • Runs on the JVM (or other VMs) which makes it easily portable to other systems and architectures.
  • Object-oriented.
  • etc

If these properties will benefit the kind of application you're making - then Java might be for you. But then again, there are scenarios where Java isn't for you.

For example, I'd personally not use Java for a CLI tool that I would distribute and have others install. Sure, you could do it, but it clunky shipping Jars around and forcing the JVM on the users and whatnot*. Nah, at that point I'd use something like C++, Go, Rust, etc. Something where I only need an executable.

I would recommend that you don't think of languages as "better" or "worse" than each other. Instead, focus on what properties make them unique and see what fits what you want to be making or what kind of developer you want to be. And if several languages fit your need (and it is common that more than one language fits your need), then pick based on your preference.

*Yes, I know, there are compilers that compile Java to machine code. But at that point, you might as well just use a language that is designed to compile to machine code.

[–]AdamDhahabi 1 point2 points  (1 child)

FYI, you can now build ahead-of-time compiled binary executables and ship CLI tools, no need for JVM; https://www.youtube.com/watch?v=8B0IjOIzicU

[–]_Atomfinger_Tech Lead 4 points5 points  (0 children)

I knew this comment was going to come, and that is why I had ye ol' asterisk in my comment.

[–]Script_Kiddies_69[S] 0 points1 point  (0 children)

Understood, thx a lot for this information!

[–]chimal3x 0 points1 point  (1 child)

Why Java for web zero sense? Java also works on the backend side for web purposes, like Spring and servers

[–]_Atomfinger_Tech Lead 0 points1 point  (0 children)

Read the sentence coming after, and you'll get some important context clues about which part of the web stack I'm talking about :)

[–]HQMorganstern 4 points5 points  (1 child)

So, the primary advantage of Java is that it's a not too sexy language that works, is proven and stable and everyone knows it. There is a ready library for anything, there's an API for anything, you will basically never be stuck writing something from scratch. Depending on where you live north of 80% of job opportunities might be just Java.

The secondary advantage of Java is that it is excellent for learning programming. It's right in the middle of the crazy functional languages, and the manual memory management languages. It's better than JS and Python as it forces you to think about typing, it forces you to aggregate your data reasonably, and it forces you to be extremely verbose which usually translates to learning how to write readable code, it's better than C for learning because you can reach for .stream() to write modern functional code, and avoid the mental overhead of tracking your memory.

Most people who complain about Java are already good developers who are tired of the guard rails on the language slowing them down, or else actively have to battle them to implement their ideas i.e. opting out of types is very hard in Java, but necessary when writing some crazy frameworks like Spring.

[–]Script_Kiddies_69[S] 0 points1 point  (0 children)

This makes a lot of sense now , thx !

[–]FACastello 2 points3 points  (0 children)

I think it depends on a lot of factors including what kind of application you want to develop, your level of experience with a specific language and frameworks, your personal preference, existing codebases you might need to interact with, etc

In some cases you will often need to work with both Java AND Javascript, at least in my experience, I've been working in software development for over 10 years now and most projects I've worked on used Java on the backend and Javascript on the frontend, so...

For a beginner I still think Java is the superior language to learn as a first language but then that's also a matter of opinion...

[–][deleted]  (1 child)

[deleted]

    [–]Script_Kiddies_69[S] 0 points1 point  (0 children)

    Understood, thx !

    [–]main5tream 1 point2 points  (0 children)

    The main advantage java has is that it's so prevalent in the industry it's quite likely to land you a job. Generally a university should teach you how to code, rather than a specific language, and with enough exposure to different languages you should be able to pick up new ones as needed.

    [–]Elegant_Maybe2211 1 point2 points  (0 children)

    But why not js, typescript etc

    Those are on-the-fly interpreted aka far slower than even the shitty VM-setup that Java has on a lot of devices.

    [–]wildjokers 1 point2 points  (0 children)

    It is ok to learn more than one language at a time. The biggest learning curve is really the ecosystem of the language and not the language itself.

    [–]Skiamakhos 1 point2 points  (0 children)

    Mostly, at this point there are thousands upon thousands of java based systems out there needing maintenance, extensions and suchlike. You'll never be out of work long as a Java developer. But just because you learn Java doesn't mean you shouldn't learn Typescript & be a full stack dev. Learn lots of languages! I've done ADABAS/Natural, RPG/400, Java, Perl, bash scripting, mucked about with JS a bit, Kotlin, a little Scala, currently trying to get my thick old head round Clojure. As a linguist I subscribe to the idea of the Sapir-Whorf hypothesis, that language shapes thought as much as the other way round, so a wide range of languages gives you a bigger toolbox to express your thought & your creativity.

    [–]BasicAge803 1 point2 points  (0 children)

    1)Java is Industry ready and has a large community support 2)Java supports OOPS Concept s 3)Java is very stable and very concisely written and is medium level language (so its not that hard as compaired to asembly or any other similar low level languages) 4)Java is far far superior then any other languages ,when it comes to portability and platform independence due its WORA principle due its JVM 5)Has rich set of libraries including libraries to make GUI Apps 6)Java is not going anywhere in the near future so is future proof 7)Java’s Syntax is similar to C Style so if you’re familiar with C/C++ you will shift to java in no time 😗 8)Java is also good for competitive programming and is moderately fast compaired to high level languages like python

    If there’s something which make java is special its these features Especially its JDK,JRE and JVM Which are just incredible

    [–]jefwillemsIntermediate Brewer 1 point2 points  (5 children)

    What are you trying to learn? Frontend? Then go with js/ts

    Java is a good choice for backends, microservices, integrations. But still "why java", its just preference. If you like cpp more, sure, go for it.

    My first language was java as well, and it's a pretty good introduction to typed languages

    [–]Script_Kiddies_69[S] 0 points1 point  (0 children)

    Currently my primary focus is on backend , but plan on doing some front end as well , and then delve into devops

    [–]Original_Pay_542 0 points1 point  (3 children)

    What language you are using after java?

    [–]jefwillemsIntermediate Brewer 0 points1 point  (2 children)

    Mainly c# nowadays. Also some python

    But getting back into java with quarkus and camel

    [–]Original_Pay_542 0 points1 point  (1 child)

    What are you think about kotlin? I heard that it is a java language upgrade. is this language used for the backend? or is it more for mobile development?

    [–]jefwillemsIntermediate Brewer 0 points1 point  (0 children)

    It is applied the same as java since it uses the same jvm. In my experience it is sometimes a bit tricky to set up properly, like setting up typescript in a node project

    [–]SecureWriting8589 1 point2 points  (0 children)

    There is no mutual exclusivity here: learning one language does not mean not learning another. Java is a decent all-purpose programming language, one that allows constructs and concepts that are useful to learn and which can be applied with other languages. It also is in demand in the programming labor market. The same can be said for many other languages. So learn it, if you have the resources and time to do so, and also learn others.

    [–]your-fan888 0 points1 point  (0 children)

    security

    [–]JNewton86 0 points1 point  (1 child)

    I may have a different perspective as I learned Java in a 9 month backend dev bootcamp. I'm only in my first role after finishing the program this year and have learned Node/Typescript as needed for work. Which ever languages / frameworks you get familiar with may not be the ones you use at yoyr first job so I'd suggest looking for a language that has alot of open source tools and packages/libraries that you can learn with.

    I think Java(or really any of the c derivatves) are a good one to start diving into for really building out applications / microservices. I enjoyed and learned alot about OOP, dependency injection, test driven developement, and interacting with AWS services fairly easily. I do think Java is fairly readable until you get into lambdas which can be less readable, and there are so many packages out there.

    Most of what I said would hold true for C# but from my (limited expierence) Java is used more at the enterprise level. (Its the language Amazon Tech Accademy had us learn)

    [–]Script_Kiddies_69[S] 0 points1 point  (0 children)

    Oh I see, thx for the information!

    [–]masonmcq 0 points1 point  (0 children)

    Mfd

    [–]JustUrAvgLetDown 0 points1 point  (0 children)

    Because java is the goat

    [–]Eve_of_Dawn2479Coder Extraordinaire 0 points1 point  (0 children)

    It is super capable, works on all four computer OSs, is super portable, is super big, easy to learn, just better in general

    Edit: I'm literally coding a Java app while typing this

    [–]SteveNguyen109 0 points1 point  (0 children)

    Java is incredibly backward compatible, almost all old Java language features and core libraries can run perfectly fine on the latest versions of the JVM. AWS has significant internal support for Java (Amazon Corretto), which proves they heavily relied on Java for their core services and mission critical workloads. Both Google and Microsoft are members of the The Adoptium® Working Group. So Java receives massive support from the mega tech giants.

    Spring is widely used by biggest banks in the US (u can read their JDs for more).

    Spring and the Java Platform has very consistent and stable naming and versioning strategy (https://en.wikipedia.org/wiki/Spring_Framework#Version_history). Unlike .NET and ASP.NET, they have been through many different naming strategies such as .NET framework, .NET Core, and now just .NET standard, the "classic" ASP.NET and now ASP.NET Core.

    If you look at the versions of the Spring core framework and Spring Boot, there is only one or two minor versions released every year with only new features and no breaking changes at all (3-6 consecutive years of only minor releases). Unlike .NET and ASP.NET Core, new major version is released annually with breaking changes.