This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
So, I'm merely a hobbyist, I write applications because I need to use them. For the most part I've been successful at successfully completing projects with the languages I've poked around with, but for some reason Java is really not connecting with me.
I get it. I understand what's happening there. I have no idea, however, how I go about using it in a project. I feel like a moron for not being able to figure out what ought to be the simplest part of this process. I've worked through tutorials, I have other applications running, but I just cannot suss out where to put this or how to access it. Perhaps it's just one of those days and tomorrow it'll be crystal clear, but right now I'm deeply frustrated and could really use just a little help on this.
For that particular code you need to look at some of the clues. First - the class is labeled as private - which means you are meant to put it inside some other class, probably an Activity. Second, it extends Thread (which is a bad idea) and so you generally execute a thread by calling the Thread.start method. You do not see the start() method in the posted code because it exists in the Thread class, so you have to know how to use the Thread object, or look up the API for it. You would probably call the start() method from a button click or something - that part isn't clear, but would make sense. So if I were to use that class* I would do something like this:
* If I were to use it I would probably make it not extend Thread, but that is for another discussion...
Joined: Jan 20, 2013
Thanks very much!
I'll give that a shot and see if I can't get it working.
Thanks, I still haven't gotten it quite working, but I think I just need to step back and go through some tutorials again so I can better understand the grammar of the language (I'm not sure if that's the right word, but it seems like it fits).
I think I expected a lot more of what I knew to translate between languages and I didn't spend enough time on the basics.
Any recommendations for tutorial series' which spend a lot of time on the structure of the language as opposed to logic, variables, and conditional statements?