MySQL tutorial SQL enum data type INSERT, UPDATE, delete operation
The enum column always has 1 default values. If you do not specify a default value, the default value is NULL for columns that contain NULL, otherwise the 1th enumeration value will be treated as the default.
If an incorrect value is inserted in the enum
In actual development, in database table design, we are often used to using an int type state field to represent the data status. This field is very convenient to represent the status of this data, however, it is unwilling to create a foreign key table for this state field to explain the state. (There may be many fields in the status of this type of table. Here is an example)
We generally treat this state
("name", a), the method PutExtra (String, parcelable) is ambiguous for the type Intent's fault, why?Since the enum itself implements the serializable interface, the Enum class is written in the source code:[Java]View Plaincopy
Public abstract class Enumextends Enumimplements Serializable, comparable
......
}
Then your MyEnum class implement
C # Enumeration type conversion string enum to String
Enumeration types are value types.
System.Enum is an abstract class (abstract class) in which all enumerated types inherit directly from it and, of course, all of its members.
All value types are descendants of System.ValueType, enumeration types are no exception, enum types inherit directly from System.Enu
We usually have an int type field, with different numbers, meaning different meanings, in order to make the program more readable and make the UI more convenient, it is a good thing to use Enum to represent the field value.For example, there is a sex field, an int type, a gender, 1 is a male, 2 is a female, then the value of the database is 1 or 2, but when we sh
Today, when I was studying the enum, I tried to import the enum using the following code but failed. from Import EnumReport the following errorAt first I was very surprised to know that any language I am currently in touch with, as long as the support enum must be included in the language of the basic package, and some languages even directly do not need to intro
In practical programming, some data is often limited, only a very small number of integers, and preferably a name for each value to facilitate the use of subsequent code, such as one weeks only seven days, only 12 months a year, a class has six courses each week.
For example, seven days a week, we can use the #define command to specify a name for each day:
#include
#define SAT 6
#define SUN 7
int main () {
int day;
scanf ("%d", day);
Switch (day) {case
mon:puts ("Monday"
Enum type converted to int typeCases:1 Public enum Gender 2 {3 male,4 female 5} 6 7 Gender Gender =8int a = Gender; 9 Console.WriteLine (a);Input Result:0There is also a feature:1 Public enum Gender 2 {3 male =5,4 female 5}67 Gender Gender =8int a = Gender; 9 Console.WriteLine (a);Input Result:51 Gender Gender =2int
An enumeration is a data type, not a constructed type, which should not be decomposed into any basic type
1 The general form of the enumeration type declaration:
Enum Enum type name
encapsulated, and most importantly, it will be checked during compilation. Because Java is a strong type, that is, during compilation, the compiler checks all prototype and parameter types. If the type is incorrect and there is no forced transformation, A compilation error is reported, except for the automatic transformation supported by the compiler. For example, if an int is required, and the input param
•
JDK1.5
you can then use
enum
keyword to define an enumeration type with the following syntax structure:
[public] enum Enumeration Name [implements interface list ] {
Enumerating Objects 1 [, Enumeration Object 2] [,... ];
[ member variable 1; ]
[ member variable 2; ]
[ ... ]
[( Static or non-static ) block of code
[ construction method 1]
[ construction metho
If a variable requires several possible values, it can be defined as an enumeration type. The reason for enumeration is to enumerate the possible values of variables or objects.
For example, to make everyone better understand, for example, there is a pen in a pencil box, but you don't know what it is before you open it, it may be a pencil or a pen. There are two possibilities, so you can define an enumeration ty
An enumeration type is a basic data type, not a constructed data type, but a new type from jdk1.5, which is generally used to make global constants . Characteristics: 1. It cannot have a public constructor This ensures that the client code has no way of creating an instance of an
Welcome reprint, Reprint please specify the Source: http://it.zhutibo.com/action/article1227.htm
Learn the first question of enumerations: Why not use the static final field instead
I think almost every person learning the Java language in the study of the enumeration is one of the first questions: Why not use the static final field instead. , the question is that you have groped for the most important function of the enumeration type: to replace the
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.