Enum
An enum is a concept introduced by jdk1.5. The value of the enum type is actually represented by the object constructed at run time. When defining an enum, the compiler will do something for us by default:
All enum classes inherit the
JAVA enum Enumeration type, javaenum Enumeration type
1. Definitions of enumeration types:
1) The Enumeration type can be a separate class file.
/** * This enum is declared in the Season.java file.*/public enum Season { WINTER, SPRING, SUMMER, FALL}
2) It can als
introduced dynamic proxies and was often used to dynamically create proxies. The dynamic proxy for the JDK is very simple to use, but it has a limitation that objects that use dynamic proxies must implement one or more interfaces. If you want to broker an inherited class that does not implement an interface, you need to use the Cglib package.3) The Cglib is implemented by ASM, ASM is a Java bytecode manipu
For something that you want to represent a finite kind of thing in a program, generally we can do it in two ways: public static final String constant, and second, using Enum to represent. In general, the former is simple, but not very good to provide more information, and in Java, the enum is very strong, but also more professional.1. most C-style
field affirms. Enumeration access, comparison is both performance (ordinal), and readability (name);
Enumeration in Java is a grammar that requires rote memorization and a design that needs to be well understood.
(experience is greater than commentary)
Principle
Enumeration provides a set of specific, compile-time syntax only (which is translated at run-time to normal), and provides a set of tailored syntax for the
A simple example shows the relationship between java packet class and variables. javapacket
1. PACKET is a folder, and the CLASS in the package accesses each other as a file.
2. The class is equivalent to a DELPHI calss. static functions can only access static functions.
Enumerations are primarily used for enumeration constants, and here is a simple application. For example, a company has the following sections:
Research department:
Sales Department:
Finance Department:
(other departments temporarily do not enumerate) some information of the department is relatively fixed, at this time can consider using enumeration to illustrate;Enum classDepts.java
Echarts Java wrapper class Library: Http://www.oschina.net/p/echarts-java Did not expect to like Echarts Java Encapsulation Class Library of people quite a lot, in the source code test example general purpose is to construct the s
Java class set _ example: many-to-many relationship notes
Instance requirements:
One student can select multiple courses and multiple students can participate in one course. This is a typical multi-to-many relationship.To complete this program, we should first define two categories: Student for student information and course for course information. There is a col
This example describes the use of object classes in Java. Share to everyone for your reference. Specifically as follows:
1. The object class is the base class for all Java classes
If the extends keyword is not used in the declaration of the
interfaceEquivalent to an implementation class object that defines the interface and overrides all the abstract methods in the interfaceSportable s=new sportable () {public void Sport () {System.out.println ("playing basketball");}};S.sport ();System.out.println (S.getclass ());//class com.aowin.noname.test$3}}Entity classClass person{public void Eat () {System.out.println ("eat");}}
Have a nice smileAsk questionsHow does a Java lambda expression and stream work???solve the problemThe syntax of a lambda expressionBasic syntax:(parameters) -> expression或(parameters) ->{ statements; }Read the example study!Example one: Define a Ayperson class to prepare for subsequent tests.package com.evada.de;impor
objects from Vector object V1 integer1//Because there are multiple integer1, start from scratch.
Find the first integer1 found in the deletion. enumeration enum = V1.elemenTS ();
System.out.println ("The vector v1 (used method removeelememt () is");
while (Enum.hasmoreelements ()) System.out.println (enum.nextelement () + "");
System.out.println ();
Use the enumeration class (enumerati
In the Java language, the string class has immutability, that is, constant strings cannot be changed. The following is a small example of a simple demonstration of related concepts.1 Public classTest {2 Public Static voidMain (String []args) {3String str1= "Hello";4 System.out.println (str1);5 Tell (STR1);6 System.out.print (STR1); 7 }8 9 Publi
"); * b = 112; *} * only To connect the stage (validate, prepare, parse) once, in fact, the entire class can be used, in the execution of new statictest, the member variables are initialized * to 0 or null, that is, a=0, and then follow the initialization of non-static code blocks and member variables in order to initialize, that is, to execute the first * {* SYSTEM.OUT.PRINTLN ("2"); *} * then execute a=110; * Last Execution Statictest () * {* S
Java enum, javaenum
1/** 2 * Created by Edward on 2016/6/30. 3 */4 public class TestEnum {5 6 // Method 7 public enum SexEnum {8 MALE, FEMALE; 9} 10 11 // method 2 12 public enum SexEnum1 {13 MALE (1), 14 FEMALE (2); 15 16 private int id; 17 18 // private constructor 19 pri
Public enum Type {IN ("input parameters "),OUT ("output parameter "),VAR ("variable ");// Define the constructor with parameters so that you can write IN ("....")Private String des;Type (String des){This. des = des;}Public String getDesc (){Return des;}}Public enum State {ON {@ OverrideString getInfo (){Return "open ";}}, OFF {@ OverrideString getInfo (){// TODO Auto-generated method stubReturn null;}};// E
In the JSP often use the data in the query database, the common practice is to use the SQL statement "SELECT * FROM tablename-id desc", this practice has a disadvantage, when the database is very large, the speed of the query will be slow, In ASP, there is a method "select Top" recpage "* FROM TableName where ID is not in (select Top" (recpage* (currentpage-1)) am p; "ID from the products ORDER by id DESC" desc "recpage for each page, CurrentPage is the current number of pages. But there is no"
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.