Skip to content

Instantly share code, notes, and snippets.

@nissuk
Created October 26, 2011 01:29
Show Gist options
  • Save nissuk/1315140 to your computer and use it in GitHub Desktop.
Save nissuk/1315140 to your computer and use it in GitHub Desktop.
Java: static importの例
// Mathのstaticメンバを修飾なしで書けるようにします。
import static java.lang.Math.*;
// System.outを修飾なしで書けるようにします。
// outはPrintStreamのインスタンスなので
// import static java.lang.System.out.*;
// とはできないそうです。
import static java.lang.System.out;
public class StaticImportExample {
public static void main(String[] args) {
out.println(pow(10, 2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment