Okay, saddle up folks.
We're gonna git some real life experience writin' actual java code!
Before you get going, you shouldread [url=http://javaranch.com/drive/about.jsp]about
the cattle drive[/url]. It explains a few things worth knowin!</em>
Here we go!
Read the Java programming tutorials, find Java programming examples and learn some Java programming basics in the cattle drive
Get the book
<em>Just Java 2</em>
by Peter van der Linden.
Download the Java SE Development Kit 7 <!-- J2SE and J2EE SDKs -->
from Sun. If you are trying to learn Java you shouldn't use an IDE. Otherwise, you learn the IDE instead of learning Java. I generally use the JDK for all of my Java work.
It is possible that once you have installed the JDK, everything will work fine as is.
If you are not one of the lucky ones, you may need to adjust your PATH and CLASSPATH
environment variables. Instructions are included with the JDK and help specific to you can
be obtained at the campfire in the Cattle Drive (java college) forum.
I put all of my stuff into a directory called java (off of my root, C:\, in Windows and
off of my home directory in unix). On my windows machine,
my PATH includes
my CLASSPATH is set to
Here is a program that you can cut and paste to make sure that you have everything set
up correctly. Make sure you put it into a file called HelloWorld.java (case is important!
even on Windows computers):
Make sure that you paste this into a text editor (like notepad) and not a word processor. A word processor will stick a bunch of extra formatting text into the file.
Pull up a console (DOS) or terminal window and put the HelloWorld.java file into your
java directory. Make the java directory your current directory. Type
and press enter. Remember: case is still very important, even on Windows computers. If
the program compiles without flaw, you will get your command prompt back. Otherwise, go to
the Cattle Drive (java college) forum and tell us what went wrong.
To run your program, type
and press enter. You should then see "hello world!" on your screen. If you
don't, post a message on the Cattle Drive (java college) forum.
JavaRanch Cattle Drive - Java Fundamentals
Read chapters 1 and 3 in "Just Java 2".
Chapter 1 will give you a good overview of what Java is all about.
<!--On page 3, Mr. van
<br /> der Linden offers to take you on a journey to compile a sample program. That program is a
<br /> little biggish for my tastes on a first whack. I suggest that you browse through that
<br /> without doing the actual work.</p> <p> Stop at the part about exceptions.
<br /> We'll look into that later. -->
Chapter 3 is going to give you an idea of the nuts and bolts of Java. The chapter mentions
"unicode" - this can be tough reading for a beginner. It also covers autoboxing and
unboxing (new in Java 5). You don't have to memorize this stuff, just kinda browse it.
Most of the chapter is about the different primitive types (I like to call them the
atomic types). This is stuff you really need to be familiar with.
You might want to read the section on Strings twice! You can just browse the sections on
byte, short and float since you won't be using those types for a while.
After the first couple of assignments, you will want to read chapters 4, 7, and 9.
Chapter 4 will introduce you to branching constructs and how to organize your statements.
Just browse the stuff on "do..while" and "continue" - you should know that it exists,
but I don't want you to use it.
Chapter 7 will have a thorough introduction to identifiers, and operators.
Make sure you thoroughly understand comments. Browse the keywords. There
will be some discussion on classes and objects - don't get too concerned with that yet.
We'll cover that later.
Chapter 9 talks a bit about arrays. Stop at the part about the Math package.
We'll look into that later.
You may want to go to Style Guide before sending me your