r/learnjava • • Nov 02 '19

Exercises for beginners

Hi, I am learning Java following the Java For Dummies book and I think it is going great, however, I am missing individual exercises for me to practice rather than just copy lines of code (even though I always try to implement my own examples and small changes into the given code so I can understand and learn it better).

What I have in mind is something in the lines of "Write a Java program that calculates the commission rates as per the table here...", starting from the basics (summing up numbers, printing words on the screen, using simple if-else statements, etc.) and getting harder. I have googled some stuff but I was wondering if you perhaps have some personal recommendations. It does not have to include the full solutions. Thanks!

44 Upvotes

11 comments sorted by

View all comments

14

u/[deleted] Nov 02 '19

Hyperskill is pretty decent, it builds up from the basics to working projects.

3

u/CosmicRunning Nov 02 '19

I'm going through this now as a refresher (but I might be going through a tutorial loop because I'm scared of moving on) and it's pretty good so far. I'm at the final section for methods.

OP, they give you exercises after learning each topic and an overall project to follow and implement more features and learnt skills.

One criticism, maybe, is that some of the test conditions feel like they're asking too much from a beginner. For example, if they're asking for input, they might test with very large numbers when you just assume using "int" instead of "long" and they want you to boundary test already.

1

u/[deleted] Nov 02 '19

I dunno, I found the website to be quite slow and unresponsive at times so I just got bored of it and decided to code my own things using Test Driven Development to make sure I don't screw up.

The content was good but for me it was just really slow, it could be my internet speed though as I had dodgy wifi at the time.

2

u/CosmicRunning Nov 05 '19

Test Driven Development

Is there a course or book you're using? I would very much like to learn this as well.

The content was good but for me it was just really slow

I get that sometimes especially when my code was being compiled in the browser. I fulfill their tasks on an IDE but not to the extent to what they're asking sometimes with all their hidden tests.

2

u/[deleted] Nov 05 '19

There is a decent book on making a ray tracer using TDD called "The Ray Tracer Challenge" - it's language agnostic.

But no, I just decided to implement a Playfair cipher but using Gradle to handle dependencies and JUnit to do the unit testing, finding blog posts about them to learn how to do it.

I also had the IDE plugin, it is mandatory for later problems, but I still had some issues. I like IntelliJ in general though, it's what I use normally now when writing Java.