StringBuffer buffer = new StringBuffer(128);
System.out.println("Some string");
ArrayList<String> list = new ArrayList<String>();
String[] spaghetti = { "a", "b", "c"}; for (String noodle : spaghetti) { System.out.println(noodle); }
/** * HTML Description here * @author Bob * @version 1.0 * @see java.lang.String */ public class Foo { /** * Method description * @param arg1 The first arg * @param arg2 The second arg * @throws FooException if things are bad * @return what it returns */ public String bar(int arg1, int arg2) throws FooException { } }
public enum Day { SUN, MON, TUE, WED, THU, FRI, SAT } public void checkDay(Day d) { if (d == Day.FRI) { System.out.println("Yippie!"); } }
/** Use to define a license for an annotated element */ public @interface License { String value(); } @License("GPL") public class MyGPLLicensedClass { ... }
public class TestRun { public static final void main(String[] args) { System.out.println("Hello World."); } }
If you like cheat sheets, you might also like my Cheat Sheet for Regex.
This is a work in progress - Questions, comments, criticism, or requests can be directed Here
Copyright © 2005 Peter Freitag (http://www.petefreitag.com/), All Rights Reserved.
This document may be printed freely as long as this notice stays intact.