Tuesday, 4 November 2008

Syntax Highlighting Experiment

As this will likely involve posting a fair bit of Java code, it would be nice to have it nicely presented, syntax highlighted and line numbered. I've found a Blogger Widget here for the Google Code SyntaxHighlighter which seems to work OK. All you need to do is put your code between HTML <pre> tags and set the class to Java as follows:

<pre name="mycode" class="java">
...
</pre>

Lets try that out with some sample code:



public class massWriting {

private String test;
private int i;

// test method
public void test(int j) {
System.out.println(i*j);
}

}



Joy!

1 comment:

Sharon Dawes said...

That's much better - so simple too :-)