Wednesday, 26 October 2011

Java: A Clock Example

Well, I may have mentioned before that the book was a load of shit when it came to threads, after all, and it's completely thrown me off how to proceed! The code we have is essentially useless because of this, but I have been looking into it.

It turns out that having a class use "implements Runnable" instead of extends Thread is the preferable way to do things like this. The class is then not an extension of a thread, but can be run by one!

I've actually completed my clock, but it's not very pretty, and annoying to understand. Here's the file if you want to look at it, though. I'll save the actual code and source for when it's not as confusing a mess as it currently is :D




http://www.megaupload.com/?d=GX5JJP08

Basically just letting you know I am working on it, it's just less friendly to write about than previous work :(


 That's all for now. Questions welcome! Comments, too!  Follow, subscribe, share etc, See you tomorrow!

And as part of a shameless plug for a friend, if you're interested in classic movies/books/music, visit his site here (fixed), and feel free to throw loads of criticism at us. 

7 comments:

  1. wow! this is helpful thanks men :)

    ReplyDelete
  2. Nice one! A lot better than anything I could code in Java at the moment haha.

    ReplyDelete
  3. Thanks man. This helped a little bit.

    ReplyDelete
  4. I want to code my own clock. (:

    ReplyDelete
  5. Damn, that's too bad. Hopefully you can find a better book or online tutorial.

    ReplyDelete
  6. Sweet I voted twice in your poll!

    ReplyDelete