Wednesday, October 29, 2008

something learned at AJUG this month

The "$" character in Java is not just for the compiler to stick into the class file names of inner classes. No, you can use it in your own class, method, and variable names too. How did I not know this?


package com.jeff_robertson;

public class $Make$Money$Fast {

public static void main(String $ARGV[]) {

String foo$bar = "foobar";

System.out.println(foo$bar);

String $perl = "...";

String BASIC$ = get$money();

}

public static String get$money() {
return "$1,000,000";
}

}

Comments: