...I go and discover something new about it. For instance, I never realised you could do this:
Which is so incredibly useful, I can't believe I never discovered it before.
Edit: and now a not-so-useful example: An alternative 'hello, world':
Edit 2: That can, in fact, be public static final HashMap<String,String> myDict;, which is arguably more useful.
class MyClass {
public static HashMap<String,String> myDict;
static {
myDict = new HashMap<String,String>();
myDict.put( "Do", "A deer, a female deer" );
myDict.put( "Re", "A drop of golden sun" );
myDict.put( "Mi", "A name I call myself" );
myDict.put( "Fa", "A long, long way to run" );
}
/* ... more stuff ... */
}
Which is so incredibly useful, I can't believe I never discovered it before.
Edit: and now a not-so-useful example: An alternative 'hello, world':
public class SillyTest {
static { System.out.println( "Hello, world" ); }
public static void main( String[] args ) {}
}
Edit 2: That can, in fact, be public static final HashMap<String,String> myDict;, which is arguably more useful.
Tags: