Skip to content

Instantly share code, notes, and snippets.

@ucchyocean
Last active August 29, 2015 14:05
Show Gist options
  • Save ucchyocean/42c6200a667d7732b50f to your computer and use it in GitHub Desktop.
Save ucchyocean/42c6200a667d7732b50f to your computer and use it in GitHub Desktop.
リテラルを使用しないで、「Hello, world!」を出力する
public class HelloWorld {
private enum A { Hello, world, Juuichimoji, Z }
public static void main (String[] args) {
System.out.println(A.Hello.name() +
(char)(A.Juuichimoji.name().length() + A.Juuichimoji.name().length() + A.Juuichimoji.name().length() + A.Juuichimoji.name().length()) +
(char)(A.Juuichimoji.name().length() + A.Juuichimoji.name().length() + A.Juuichimoji.name().length() - A.Z.name().length())
+ A.world.name() +
(char)(A.Juuichimoji.name().length() + A.Juuichimoji.name().length() + A.Juuichimoji.name().length())
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment