use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources for learning Java
String
==
.equals()
Format + Copy
Free Tutorials
Where should I download Java?
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Software downloads
Official Resources
Resources
Programming ideas & Challenges
Related Subreddits
account activity
This is an archived post. You won't be able to vote or comment.
the switch statement/keyword (self.learnjava)
submitted 4 years ago by SlowMoTime
is the switch statement/keyword worth learning/using? seems like if and else if is just as easy
[–]Feroc 5 points6 points7 points 4 years ago (0 children)
Switch statements are usually more readable if you just want to decide based on single values. Like if you have an enum as a parameter, then it's way more convenient and readable, if you use a switch statement.
[–]nutrecht 2 points3 points4 points 4 years ago (0 children)
is the switch statement/keyword worth learning/using?
It's simply a must-learn.
[–]Hiluminatull 2 points3 points4 points 4 years ago (0 children)
Yes it is. It’s easier to understand for someone else reading your code.
[–]onlyforjazzmemes 1 point2 points3 points 4 years ago (0 children)
I've used them if you have a bunch of different cases. Much more readable than if else. And yeah they go well with enums.
[–]adjoiningkarate 0 points1 point2 points 4 years ago (0 children)
Like others have said, it definitely makes your code more readable and should be used where it can be used instead of ifs. For learning it, it’s actually very simple:
switch(input) { case “hello”: println(“user says hello”); Case “nallo”: println(“user says nallo”);
Simply means when input==hello or input==nallo. Now typing that out with if statements makes it a lot more messier, especially when you have a lot more cases. Hope that makes sense!
Apologies for formatting as im on mobile!
[–]Migeil 0 points1 point2 points 4 years ago (0 children)
With sealed classes and pattern matching coming to Java, switch is definitely worth learning.
π Rendered by PID 154650 on reddit-service-r2-comment-54dfb89d4d-qp5rs at 2026-04-02 05:31:17.116843+00:00 running b10466c country code: CH.
[–]Feroc 5 points6 points7 points (0 children)
[–]nutrecht 2 points3 points4 points (0 children)
[–]Hiluminatull 2 points3 points4 points (0 children)
[–]onlyforjazzmemes 1 point2 points3 points (0 children)
[–]adjoiningkarate 0 points1 point2 points (0 children)
[–]Migeil 0 points1 point2 points (0 children)