Java 8 introduced the @Exported
annotation and its documentation states the following:
Indicates whether or not a JDK specific type or package is an exported part of the JDK suitable for use outside of the JDK implementation itself.
What is an exported part of the JDK? Should I use any types marked with such annotation? Is it considered safe?
For example, this annotation is present on the com.sun.net.httpserver.HttpServer
class.
Creating a Repeatable Annotation Java 8 has added a new annotation called '@Repeatable' in the 'java. lang. annotation' package to support annotations that can be repeated. Following the example above will define the 'Season' annotation with the '@Repeatable' annotation specified.
With Java 8, annotations can now also be written on any use of a type such as types in declarations, generics, and casts: @Encrypted String data; List<@NonNull String> strings; myGraph = (@Immutable Graph) tmpGraph; At first glance, type annotations aren't the sexiest feature of the new Java release.
Correct Option: C. @Overriden is not a pre defined annotation in Java.
As of the Java SE 8 release, annotations can also be applied to any type use. This means that annotations can be used anywhere you use a type. A few examples of where types are used are class instance creation expressions (new), casts, implements clauses, and throws clauses.
See its javadoc:
Indicates whether or not a JDK specific type or package is an exported part of the JDK suitable for use outside of the JDK implementation itself. This annotation should only be applied to types and packages outside of the Java SE namespaces of
java.*
andjavax.*
packages. For example, certain portions ofcom.sun.*
are official parts of the JDK meant to be generally usable while other portions ofcom.sun.*
are not. This annotation type allows those portions to be easily and programmatically distinguished.
So it's safe to use JDK-supplied classes annotated with that, but you should not be using that annotation in your own classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With