Warm so know new, can for teacher!
Review every day, or learn a little thing, also can stones!
Review 5 Java built-in basic annotations today (the code is better than thousands of thousand):
Packagecom.lf.test;Importjava.util.ArrayList;Importjava.util.List; Public classTest1extendsObject {//[email protected] (jdk1.5 update)//Override means: overriding@Override PublicString toString () {return Super. toString (); } //2.SuppressWarnings (jdk1.5 update)//@SuppressWarnings ("Rawtypes") means: Suppress compiler warning (clear here)//rawtypes (single type)//@SuppressWarnings (value={"Unchecked", "Rawtypes"})//{"Unchecked", "Rawtypes"} (multiple types)//@SuppressWarnings ("All")//All (All)@SuppressWarnings ("All") Public Static voidMain (string[] args) {List user=NewArrayList (); } //[email protected] (jdk1.5 update)//@Deprecated indicates that a program element (class, method, and so on) is obsolete@Deprecated Public Static voidQueryuser () {}//4.SafeVarargs (jdk1.7 update) said: specifically to suppress "heap pollution" warning provided. }//[email protected] (jdk1.8 update) means to specify that an interface must be a functional interface, or it will compile an error. //Functional Interface: JAVA8 Specifies that if there is only one abstract method in the interface (which can contain multiple default methods or multiple static methods), the interface is called a functional interface. //such as:@FunctionalInterfaceInterfacefunction {Static voidStaticfun () {System.out.println ("Static Method"); } default voidDefaultfun () {System.out.println ("Default Method"); } voidAbstractfun ();//only an abstract method, such as an abstract method, is defined and an error is made.}
If there are errors, please leave a message!
Java built-in annotations basic annotations