-1

Possible Duplicate:
What does the “static” modifier after “import” mean?

import static java.nio.file.StandardOpenOption.APPEND;

What is the role of static in it?And why is it mandatory?

Community
  • 1
  • 1
CoffeeCup
  • 67
  • 1
  • 3

3 Answers3

3

This oracle documentation should help: http://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html

Matthewek
  • 1,519
  • 2
  • 22
  • 42
0

Because in your code you can use:

APPEND

If you didn't imported this as static you had to give full path:

java.nio.file.StandardOpenOption.APPEND;
Иван Бишевац
  • 13,811
  • 21
  • 66
  • 93
0

Copied from here.

Static import is a feature introduced in the Java programming language that allows members (fields and methods) defined in a class as public static to be used in Java code without specifying the class in which the field is defined. This feature was introduced into the language in version 5.0.

developer110
  • 508
  • 6
  • 9