Created
October 26, 2011 01:29
-
-
Save nissuk/1315140 to your computer and use it in GitHub Desktop.
Java: static importの例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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