Are you using static import?
I am rewriting a Java book for beginners, and it seems to make so much sense
import static java.lang.System.out;
public class Greeting
public static void main(String args)
I would no longer have to
dissect the awful
System.out.println("Hello, World!") expression.
(Ok, boys and girls.
System is a class.
a static field of type
PrintStream. That's another class. What is
static, you ask? It's what a TV set makes when it doesn't get a signal. No,
it's what you don't want in your dryer. Ok, whatever it is, you don't ever want
to do it in your code, unless it is also
final. That means, you
can't change it. Oh, you spotted
Ditto with mathematical expressions. Doesn't
sin(angle * PI / 180)
look so much nicer than
Math.sin(angle * Math.PI / 180)
Ok, at least to that tiny fraction of the population who knows
The fact is, I don't recall ever seeing anyone using static import outside
JUnit 4, where it is justifiably popular to import
I made a Google search, only to find a
href="http://www.davidflanagan.com/blog/000028.html">sensible blog whose
comments were filled with rants that static imports are the work of the
antichrist, something on href="http://blogs.msdn.com/ericgu/archive/2004/07/01/171141.aspx">static
imports in C#, a href="http://www.javapractices.com/topic/TopicAction.do?Id=195">recommendation
to use it rarely, and the usual certification garbage ( href="http://www.ucertify.com/article/what-is-static-import.html">here and
I am trying to get the reaction of the average Java coder here. Have you
out with a static import?
Would you think it weird to look at other people's code that did that? Or would
you welcome it?