I have a plan.. Ok maybe not so much of a plan as a lose set of possibilities. One of which is to make apps for the Blackberry. The reasons are 2 fold. One is to make any oddball app that I want, though I have to admit the Blackberry community is pretty good at covering that. The other is to make some a little bit of money, if I can sell 100 copies of a app that people want at a $1 a piece, that’s still $100 bucks more then I started with. Not to mention the fact that in most cases I probably want the app also. It give me more programming experience, so I’ll be getting paid to learn. Finally anything that is a web technology is good for my current career choice. Not a bad deal all the way around.
Of course there is a slight problem, part one of this many part problem is knowledge of the Java Programming language. I’m a little lacking there. So This is the beginning of Project file on learning Java.
What will be seen under this category and tags is my notes on learning the language and some of the pitfalls along the way. I know they will be useful for me, but I also hope that they will be useful to anybody else that may be trying to learn the language at a future date. I guess one more thing I should say is I’m not trying to teach the language here. There are plenty of books out there and some websites that will do that. Again, this is more my thoughts, notes, and “discoveries”
My posts and projects are a bit disjointed at the moment, I have this listed as Project 2 even though it will probably be posted before project one. I will be bouncing around to give the brain a break on a particular topic, and even thought I started the server project a bit ago, Java is what I’m working on now.
What I’m using:
I personally learn best from various “teach yourself” books and the one I’m reading right now is called “Head First Java” Second Edition, by Kathy Sierra, and Bert Bates (ISBN 0596009208) (hmmm side note, I guess if I’m going to do that I should learn how to do a proper citation). It’s a 2005 book, but I don’t see a 3rd edition at this time, and this one does seem to be well regarded, with good and recent reviews. So I guess it’s a good place to start.
For Java, using JDK 6 update16, which btw this was the first sticking point in learning Java. You can’t just go to Sun’s website and click on the java button. That’s going to take you the version that you need to run apps. To write programs you need the development tools. Personally there is to many choices at that link. If all your trying to do for now is learn java look for the block that’s labeled Java SE Development Kit (JDK). Download that and install. The Book recommends also downloading the documentation. Which I did, but haven’t installed it yet. After getting it installed I had to add to the windows Path statement where the JDK Bin files where. When copying the path from windows explorer make sure to copy the path to the JDK, not the JRE that installs. Yeah, Duh! I know, makes sense huh? Well sometimes logic fails at 2am.. oops!
Today’s Notes:
Source file Contains one Class, Class Contains one or more Methods, One method contains a set of statements.
Basic “Hello World” Program:
class HelloWorldApp {
public static void main (String[] args) {
System.out.println(“Hello World!”);
}
}
NOTE the “S” in String[] is capitalized. Along with System, but I had gotten that one right. (Book uses a different example)
Must have a “main” method in every app, but not in every class. Apps can contain multiple Class files.
Syntax:
- Statements end in Semicolon’s
- Most white spaces don’t matter
- Must declare type and name of variables (ie. int weight;)
- Classes and methods must be defined with in curly braces { }
- // Single Line Comments
- /* Multiline comments
are like this with the Asterisk slashes */
while (condition) {
statement;
}
for (initialization; termination; increment) {
Statement;
}
One thing I can’t seem to remember the order of creation.
- write / Save the .java file
- Comple .java file : javac appfile.java This makes the .class file
- Run the .class file: java appfile.
Comments
Leave a comment Trackback