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

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.

3

u/desrtfx Nov 02 '19

Head over to /r/learnprogramming and check the FAQ/WIKI there. It has huge lists of project ideas.

Also, ditch the "for dummies" book and do a proper course, like the MOOC Object Oriented Programming with Java from the University of Helsinki. It has plenty graded exercises.

3

u/nelicow Nov 03 '19 edited Nov 03 '19

I did the Helsinki MOOC earlier this year. I learned a lot quickly. It has good pacing in introducing new concepts and mixes theory with exercises well. Great course, and free too!

For just some mini-projects/exercises you could also try http://codekata.com/

2

u/DoYouDestinyBrah Nov 02 '19

What about the exercises in the mooc? That’s exactly how they’re structured

1

u/2cool4school007 Nov 02 '19

if you found send me some xD

1

u/[deleted] Nov 02 '19

Just go to hackerrank and start 30 days of code with java. Trust me it's awesome for beginners.

0

u/[deleted] Nov 03 '19

[deleted]

2

u/czechrussianchick Nov 03 '19

Thanks for the opinion. However, I am quite satisfied with the book, everything is thoroughly explained and the way it teaches makes sense to me, I just need more actual practice apart from the thorough explaining.

Ad 2.: I think we all know "for dummies" is meant in a funny, not a condescending way. And to be fair, I am a programming dummy as I picked programming up not because I am super into computer stuff or even remotely good at it (I'm basically an IT dinosaur), but because I wanted to challenge myself and learn something totally out of my range of abilities but I still need to do it at my own pace and that's why I actually like the book.