Home Accessibility Courses Diary The Mouth Facebook Resources Site Map About Us Contact
Hello World - a good traditional start to a Java course

All programming courses, it seems, start with a "Hello World" program. It's almost a tradition and while I'm not one of those people who follows traditions just for their sake, traditions usually are founded on good reason. This one is, and we follow it!

When you come new to a programming language, you want to see an overview of the picture of how it works very quickly. You want to see how to write the source code, what the shortest program looks like, and also how to store, compile (if necessary) and run the program. You want to make sure that all your tools such as compilers, virtual machines (whatever they are / if your need them) and run time libraries exist and are correctly loaded, and that everything is on the right path and with the right permissions. Most of these things will be automatically there in most cases ... but you need to be reassured and to check with the shortest of programs. Take the car out for a test drive before you start any real journeys!

On yesterday's Learning to Program in Java course, we started off with a look at the Java environment - JVM, JRE, JDK and put components such as the java compiler and jvm ('java') into place. Then we wrote this simple program into a file called Adam.java

public class Adam {
  public static void main(String [] args) {
    System.out.println("Ello Wurld");
  }
}


and compiled and ran it:

Dorothy-2:java grahamellis$ javac Adam.java
Dorothy-2:java grahamellis$ java Adam
Ello Wurld
Dorothy-2:java grahamellis$


It might all look very basic - but even here there are some traps to catch the unwary - for example:

• To compile you do give the extension as you're giving a file name in the current directory.

• To run, you do NOT give an extension as it's looking for a path on the CLASSPATH which may be a file, or it may be within a jar.

During the course, I said a lot more - filled the class in on lots of other things and had them writing other and more complex code once we had the test drive out of the way. With Java , a language that's really very much better for the substantial application that the one liner, the structuring into functions is vital from day one, as is the interfacing to other resources and by the middle of the day we had progressed from a program called Adam to oe called Chloe - with command line inputs, variables, calculations, internal methods and more. If you want to take a look at Chloe, she's here.
(written 2009-09-22)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
G504 - Well House Consultants - Writing Notes
  [4031] Showing what programming errors look like - web site pitfall - (2013-03-06)
  [4009] Clear, concise examples - Ruby classes and objects. - (2013-02-17)
  [3152] Jargon busting - (2011-01-30)
  [2828] Sharing our programs - easy. Sharing our data - harder. - (2010-06-26)
  [2812] What is Perl? - (2010-06-15)
  [2481] Sample code with errors in it on our web site - (2009-10-29)
  [2192] Copy writing - allowing for the cut - (2009-05-21)
  [2010] How long should a training module be? - (2009-01-27)
  [1950] Copyright of Training Notes and Web Site - (2008-12-18)
  [982] Notes from the white board - (2006-12-14)
  [979] Empty seats, Nodding Donkeys and buses - (2006-12-11)
  [797] Writing up new C / C++ notes. - (2006-07-09)
  [407] Theft of training material - (2005-08-09)
  [398] Training course material - why we write our own - (2005-07-30)
  [394] A year on - should we offer certified PHP courses - (2005-07-28)
  [9] Study room - the Oxford train - (2004-08-10)
  [7] Writing on a Sunday - (2004-08-08)
  [4] Seeing the wood for the trees. - (2004-08-06)

J702 - Hello Java World
  [2859] Using java, javac, jar, and CLASSPATH - a simple example - (2010-07-07)


Back to
Sanity checking the price, and selling up to increase income
Previous and next
or
Horse's mouth home
Forward to
Variable names like i and j - why?
Some other Articles
Viv.java uses unchecked or unsafe operations - explanation and cure
Java Programming Fundamentals
Automating access to a page obscured behind a holding page
Variable names like i and j - why?
Hello World - a good traditional start to a Java course
Sanity checking the price, and selling up to increase income
Autumn Fruits and Bristol Old Station
Further North - long summer days and lovely countryside
Removal of technical resources from this site
TypeError: super() argument 1 must be type, not classobj (Python)
4280 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2414_Hel ... ourse.html • PAGE BUILT: Sun Mar 30 15:20:58 2014 • BUILD SYSTEM: WomanWithCat