ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Rethinking the Java Curriculum: Goodbye, HelloWorld!
Subject:   Print out the System Properties
Date:   2002-08-27 07:20:40
From:   bayard
I long ago dumped Hello World in favour of the following snippet:



package test;


import java.util.Properties;


public class ShowProperties {


static public void main(String[] args) {
Properties props = System.getProperties();
props.list(System.err);
}


}


It can start very small [without the import and without the package. Just declaring java.util.Properties direct] and can grow larger by switching to an instance of of ShowProperties, then waking over the Properties instead of using list(OutputStream) etc.


One of Hello World's great problems is that it doesn't scope. You do it on the command line. You do it in a GUI. On a webpage. But there's no easy continuation of the lesson, you just throw it away.


A Properties outputter gives you a nice timeline into many of the core Java concepts.


1 to 1 of 1
1 to 1 of 1