Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Random Java Programs

So, my brother needed to present 20 java programs for school. He didn’t have to make them himself, he said. Just to print them out and submit them. (What kind of ridiculous compsci teacher asks for hardcopies of source instead of softcopies?)

Anyway, I said, sure. I’ll make some, it’ll be easy. After all, trivial programs shouldn’t take me more than 5 minutes each right? It was true, each one didn’t take long. But I spent quite some time thinking about what I would actually code. The usual suspects are there – Hello World, prime factors, factorial, simple arithmetic, palindromes. It was just harder than I thought making up twenty diverse trivial java programs to write. I’m not a teacher after all :p

Anyway, in case someone in the world finds these examples useful: Twenty random java programs.

EDIT 2020: Since the above link is no longer accessible, I’ve just uploaded the twenty programs as a github repository.

Posted by under post at #Software Development
Also on: blogger / 0 / 158 words

See Also