I. Basic knowledge of annotations1, Yuan annotation:@Retention @Target @Document @Inherited 2, annotation type is defined as @interface, all the annotation will automatically inherit java.lang.Annotation this interface, and can not inherit another
I. Appearance of the background:Before JDK1.5, we defined constants like this: public static final String red = "red";The enumeration types are added to JDK1.5, and we can group related constants into an enumeration class:public enum Color {RED,
Original: http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html.Meta-Annotations:The role of meta annotations is to be responsible for annotating other annotations. Java5.0 defines 4 standard meta-annotation types, which are used to provide
First, Preface: Why should have the code automatic generation?The simplest and most straightforward answer to this question is: Instead of writing code manually, improve productivity.What scenarios and codes are appropriate for automatic generation
Using abstract methods in enumerations/*** Defines an abstract method for an enumeration class, * This abstract method provides different implementations by different enumeration values * *@authorWangzhu * @date 2014-9-15 pm 5:35:04 **/ Public
8. Enumeration (enum) Use exampleThe simple form of declaring an enumeration type is as follows:enum enum class name {value 1[, value 2, ...]};Example 8. Adds a secondary method to the enumeration class. Packageset; Public enumSize {SMALL ("S"),
Google Java Programming style guideObjectiveThis document is a complete definition of the Google Java Programming style specification. When and only if a Java source file conforms to the rules in this document, we think it conforms to Google's Java
What is object-oriented? Process oriented. Process-oriented: solving a problem with the idea and method and the steps object-oriented: abstract some problems with the same characteristics into an object, and use "" "" "" "" "" "to call. The three
Java1.5 provides a keyword enum that makes it easy to define the type of enumeration you need, for example
enum Season {
SPRING, SUMMER, AUTUMN, WINTER
}
A seasonal enumeration type is defined.In this case, for season.spring
C++11 Standard has been determined, in addition to a lot of library functions, in the syntax convenient also got a lot of enhancements. Here are a few of the syntax that I like more:Automatic type Deduction AutoC + + is now finally supporting C
What is an enumeration typeIf you define a class to complete enterprise employee information, employee information includes information such as name, age, and position (three roles for the worker, manager, and Boss), complete with the following code:
The content of this article:
Introduction to annotation annotation
Usage of basic annotations
Starting Date: 2018-07-28 Introduction to annotation annotation
Annotation is a special tag in the code that can be identified
One: Reflection (Reflect) 1.1, overviewSummary: the ability to dynamically get the information of a class and the way the object is called dynamically (the way the runtime obtains and uses the class's information is called Reflection )1.2. Main
jdk5.0 and versions after 5.0:
Static Import
Automatic packing and unpacking
Enhanced for Loop
Variable parameters
Enum type
Generic type
Reflection
Introspection
Meta data
Static Import
Java1.5 provides a keyword enum that makes it easy to define the type of enumeration you need, for exampleenum Season {SPRING, SUMMER, AUTUMN, WINTER}a seasonal enumeration type is defined. in this case, for season.spring this object,
Singleton mode: "A class has and has only one instance, and self-instantiation is provided to the system as a whole." ”There are a number of ways to implement a singleton pattern, such as lazy mode (and so on when the time is instantiated), a Hungry
Java1.5 provides a keyword enum that makes it easy to define the type of enumeration you need, for example
enum Season {
SPRING, SUMMER, AUTUMN, WINTER
}
A seasonal enumeration type is defined.In this case, for season.spring
public enum color{Red,blue,black,yellowgreen}1.enum is much like a special class, in fact the type of the enum declaration definition is one of the classes2. These classes are subclasses of the Enum class in the class library (java.lang.enum), which
All enum classes are subclasses of Java.lang.Enum, so custom enumeration classes cannot inherit other classesCommon methods for enumerating classes:
values () :
is a static method that is added to
Reprint Please specify source: http://www.cnblogs.com/skywang12345/admin/EditPosts.aspx?postid=3311275part 1th iterator and enumeration differencesIn the Java collection, we usually iterate through the collection with "Iterator (iterator)" or
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.