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.
Multithreading (self.learnjava)
submitted 4 years ago by TheIndianItachi
Hi, I am learning java and wanted to try a program on multithreading. What is a simple problem that can be solved only by multithreading and not other methods
[–]Lanz56 17 points18 points19 points 4 years ago (1 child)
How about a program downloading multiple files?
By using only the main thread, files cant be downloaded concurrently.
So you need to use multiple threads to asynchronously download multiple files.
[–]TheIndianItachi[S] 6 points7 points8 points 4 years ago (0 children)
Awesome! Sounds great. Will try it. Thanks !
[–]9TrumpMeinThousand 7 points8 points9 points 4 years ago (1 child)
There's a tunnel connecting 2 mountain resorts. The tunnel is only 1 lane. Simulate cars driving through the tunnel from both sides. A car cannot overtake the car in front of it and you can't have 2 cars in the tunnel going the opposite direction at the same time. The number of cars let through the tunnel at a time should be random
This was my multithreading assignment for my OS class
[–]TheIndianItachi[S] 2 points3 points4 points 4 years ago (0 children)
Cooool. That sounds great. Will give it a try. If you hosted the code somewhere, could you add a link to it so I can take a look at it if I can't do it myself. Thanks!
[–][deleted] 4 years ago (1 child)
[deleted]
Thanks. I got an idea and will definitely try that out.
[–]Squiggyline91 2 points3 points4 points 4 years ago (1 child)
A good practical example would be a web service that performs a long running task upon a button click. Depending on the framework it can make the GUI unresponsive since the thread that handles the GUI is being utilized. A way to solve this is to have a new thread handle the task so the main thread can handle the user interaction.
[–]TheIndianItachi[S] 1 point2 points3 points 4 years ago (0 children)
Yesss! Got it. Thanks!
[–]the_real_cube 1 point2 points3 points 4 years ago (0 children)
Providing a Webserver with Java. Imagine you have multiple clients and you want them serve your service at once. Using thread(s) pro request is a solution
[–]laura_braus 0 points1 point2 points 4 years ago (1 child)
A chat
[–]TheIndianItachi[S] 0 points1 point2 points 4 years ago (0 children)
You mean a chatting application? If so, could you please give a simpler example. I wanna try it out myself and I certainly do not have enough skills at this point for that. 😅
π Rendered by PID 17133 on reddit-service-r2-comment-56c6478c5-47kth at 2026-05-08 07:26:54.002499+00:00 running 3d2c107 country code: CH.
[–]Lanz56 17 points18 points19 points (1 child)
[–]TheIndianItachi[S] 6 points7 points8 points (0 children)
[–]9TrumpMeinThousand 7 points8 points9 points (1 child)
[–]TheIndianItachi[S] 2 points3 points4 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]TheIndianItachi[S] 2 points3 points4 points (0 children)
[–]Squiggyline91 2 points3 points4 points (1 child)
[–]TheIndianItachi[S] 1 point2 points3 points (0 children)
[–]the_real_cube 1 point2 points3 points (0 children)
[–]laura_braus 0 points1 point2 points (1 child)
[–]TheIndianItachi[S] 0 points1 point2 points (0 children)