Java built-in annotations basic annotations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.