[ prog / sol / mona ]

prog


I need to learn Java well, fast.

1 2020-03-09 11:45

Hi prog,

I've been programming for ~10 years now, but mostly in fp-adjacent languages. The only conventional OOP language I've used for work is Ruby.

In my new job I need to do a lot of Java. I've avoided Java like the plague for all my working life, but I know the time has come to bite the bullet and learn it.

Can anyone recommend good books/tutorials *with exercises* that I could use to get up to speed with Java?

2 2020-03-09 16:03 *

https://docs.oracle.com/javase/tutorial/index.html

3 2020-03-09 18:09

Syntax wise or programming wise, it shouldn't be anything new. You've got classes, interfaces, enums. Occasionally one meats unusual constructs, such as local classes or tags, but those are the things you can learn on the fly.

What usually tends to be a lot more important is a solid grasp of the standard library, especially the collection framework (https://docs.oracle.com/javase/tutorial/collections/index.html) and the I/O package (https://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html). Also, depending on what {build system, testing framework} you will be using, consider learning it's basics, so that you don't waste your time trying to get things to work, when you would want to be working.

4 2020-03-09 18:25

When I was a university student, I used the official tutorials. They are pretty well written and will get you up to speed with the basics quickly.

However, if you are already writing Java -- as your post suggests -- a better choice might be Effective Java by Joshua Bloch. Unfortunately it does not have exercises, but otherwise is the usual recommendation for developers who are new to Java but not completely clueless.

For exercises, you can find countless so-called ``katas'' on the Internet, many of them were originally written for Java. Sadly I don't know of any single repository with high quality exercises, if you happen to find one, please do share. There are websites where you can do similar exercises interactively. The only one I used is exercism.io, which has mentors reviewing your code for you. The only reason I am reluctant to recommend it is because they provide unit tests instead of having you write them yourself. (On the other hand, for Scheme programmers I would recommend it wholeheartedly.)

It might also be advisable to learn the basics of UML. Even if you won't use it yourself, it is likely that your coworkers will end up drawing up something really similar to it at the whiteboard. For this a good book is UML for Java Programmers. (Or maybe people don't use it anymore? My coworkers do, although we don't write Java.)

If you are bored, A Little Java, a Few Patterns by Felleisen and Friedman is a pretty fun take on Java, just be sure never to actually write code like that. No. You should NEVER! No matter the weather!!

5 2020-03-10 08:10

Thanks everyone. I'll get acquainted with the official Oracle tutorials, and take a look at "Effective Java". I've done exercism.io tracks in the past for some languages, doing it for Java is probably a good idea, thank you for the reminder. I'll also be sure to get that Felleisen/Friedmann book to add to my collection and *never* code like that, ever!

6 2020-04-09 23:12

Hi, new here. "Effective Java" is awful. Get a book like "Head First Java" instead.

Also install IntelliJ IDEA from Jetbrains as an IDE, and get your Java SDK from https://adoptopenjdk.net/.

Long story short, "Oracle Java" is evil, OpenJDK is acceptable but you can only download the latest version which can be annoying in your job, AdoptOpenJDK is an archive of everything.

7 2020-04-09 23:18

solid advice.

8 2020-10-14 18:48

Is OP still here? Would like to hear an update.

9


VIP:

do not edit these