• Post Reply Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This page was migrated from a javaranch.com.jsp



Okay, saddle up folks.
     We're gonna git some real life experience writin' actual java code!
     Before you get going, you should read [url=http://javaranch.com/drive/about.jsp]about
     the cattle drive[/url]
. It explains a few things worth knowin!



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
   completed assignments.


Have you read about the Cattle Drive yet?
   Yep? Then let%27s git them dogies movin%27.

   Here are your assignments:
   Assignment Java-1 (Hundred)
   Assignment Java-2 (EvenOrOdd)
   Assignment Java-3 (Leap)
   Assignment Java-4 (Say)
   Assignment Java-5 (Times)
   Assignment Java-6 (Grains)
   Assignment Java-7 (Sum)
   Assignment Java-8 (GeekWatch)

   JavaRanch Cattle Drive - Classes and Objects

   Assignment OOP-1 (DaysOld)
   Assignment OOP-2 (NaturalLanguageMultiply)
   Assignment OOP-3 (SortNames)
   Assignment OOP-4 (Lookup)

   JavaRanch Cattle Drive - Servlets

   Assignment Servlets-1 (NowServlet)
   Assignment Servlets-2 (ReverseServlet)
   Assignment Servlets-3 (Reverse2Servlet)
   Assignment Servlets-3b
   Assignment Servlets-4a (Videos)
   Assignment Servlets-4b
   JavaRanch Cattle Drive - JDBC

   Assignment JDBC-1
   Assignment JDBC-2a
   Assignment JDBC-2b
   Assignment JDBC-3a
   Assignment JDBC-3b
   Assignment JDBC-4

Page maintained by
Marilyn de Queiroz

Playtime diversion:  Paul Wheaton, who wrote the original Java College, now dabbles in permaculture. He%27s a certified master gardener and has written articles on organic lawn care, proper use of diatomaceous earth and a new way of raising chickens.  His research into less toxic living prompted him to write about using cast iron skillets and a healthier way to control fleas in the home.

You can follow Paul%27s future work on his permaculture blog, his Missoula blog or by following his permaculture podcasts or permaculture videos.

    Bookmark Topic Watch Topic
  • New Topic