Skip to content

Instantly share code, notes, and snippets.

@mdstoy
Created March 21, 2018 06:57
Show Gist options
  • Save mdstoy/10256f5d77c79183d1f5df651a43deae to your computer and use it in GitHub Desktop.
Save mdstoy/10256f5d77c79183d1f5df651a43deae to your computer and use it in GitHub Desktop.
当たり前だけど、クラスファイルは二つできてしまいますね。1 java ファイル に対して 1 class ファイルが義務付けられる現場の方はご愁傷さまでした。
$ javac VarAnonymousClass.java
$ ls -1
VarAnonymousClass$1.class
VarAnonymousClass.class
VarAnonymousClass.java
$
public class VarAnonymousClass{
public static void main (String[] args) {
var obj = new Object(){
int value() {
return 1;
}
};
System.out.println(obj.value());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment