Read about core java volume ii advanced features, The latest news, videos, and discussion topics about core java volume ii advanced features from alibabacloud.com
6.1.2 interface is not a class, cannot instantiate an interface, but can declare the variable of the interface; comparable x; The interface variable must refer to the class object that implements the interface; x = new Employee ();Checks whether an object belongs to a particular class (instanceof);Checks whether an object belongs to a particular interface (instance), if (AnObject instanceof comparable) {...}6.1.3 Interfaces and abstract classesAn abstract class can only extend one class (single
Java EE 6ProposedBean ValidationStandard, with annotationsJavaBean constraints, not limited to a certain level or a programming model, flexible and easy to use. The following describes the features of this specification.
Overview Bean Validation specifications
Bean is the abbreviation of Java Bean. in the practical application of
Java core technology-New Features of Java 8-Lambda expressions1. General description
Java 8 new featuresFunctional InterfaceLambda expressions (closures)2 Java 8 new features
Oracle rel
Deep understanding of Java Virtual Machine: JVM advanced features and best practices (in-depth analysis of JVM Based on issues such as memory management and high concurrency)
Provides a comprehensive and in-depth analysis of JVM based on core content such as memory management, execution subsystem, programming compilati
need to runJavaapplication's operating system, first install aJavaVirtual Machines(JVMJavaVirtual machine)can be. byJvmto be responsibleJavaThe operation of the program in the system. In simple terms, the program code is compiled and converted to a type calledJavathe middle language of the byte code,JavaVirtual Machines (JVMThe bytecode is interpreted and run. Compilation occurs only once, and interpretation occurs every time the program is run. The compiled bytecode takes aJVMThe optimized mac
"In-depth understanding of Java Virtual machines: JVM advanced features and best practices" PDF download Link:https://u253469.pipipan.com/fs/253469-230062566Content IntroductionAs a Java programmer, have you ever wanted to dig deeper into the Java virtual machine, but have b
A core feature of the Bean Validation (JSR 303)--java EE 6, which defines a metadata model and API for entity validation. Its default metadata source is annotations, but developers can extend it through an XML descriptor. The Validation API does not rely on a particular application layer or programming model, so that the same set of validations can be shared by all tiers of the application. It also provides
engine and metadata repository for object constraints. The framework that requires constraint definition, verification, and metadata (JavaEE or Java
Se) bean validation specifications can be used to accomplish these functions. From the perspective of applications or infrastructure, this can avoid unnecessary repetitive work.
Bean validation has been integrated into JSF 2.0 and JPA 2.0. In JSF, You can bind the form input field to the attribute of the
onClick(View view) { try { method.invoke(activity); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } });}Done! Isn't it simple?We realize the function of Butterknife by using reflection to get annotations, but the article begins with the lack of reflection performance. In fact, Butterknife itself is not a reflection, but the
recycled by GC because they are circular references to each other.2. Root Search algorithmA series of objects named "GC Roots" are used as starting points from which to search down, and when you reach objects that are not on the GC Roots reference chain, even if they are related to each other, they are still considered recyclable objects.Using the theory of graph theory, can be expressed as GC roots to the object unreachable .3. Better understanding of "references"In
Java annotations are jdk1.5 after the new features, for its application is very broad, we first look at the application of annotations, Baidu Encyclopedia said:As we can see, the role of annotations has three aspects:Write Doc documents: This is a very common @return and @author, add these annotations, we can use the JDK to help us automatically generate the corresponding API documentationCompile check: Thi
The first part walks into Java one, into Java1. OverviewJava is widely used in embedded systems, mobile terminals, enterprise servers, mainframe and other occasions, to get rid of the constraints of the hardware platform, to achieve the "write once, run everywhere" ideal2. Java Technology Architecture According to the function to divideIncludes the following components:
Why is the use of volatile lower than the cost of synchronization?
The cost of synchronization is mainly determined by its coverage, and if you can reduce the coverage of synchronization, you can significantly improve program performance.
And volatile's coverage is variable-level only. Therefore, its synchronization cost is very low.
What is the volatile principle?
Volatile's semantics, in fact, is to tell the processor, do not put me into working memory, please directly in main memory opera
class, we can basically think of an enumeration class as a regular Java class, where we can add new methods, including abstract methods and even the main method.Now we use enumerations to implement the gender function above. Public enumEnumsex {man, WOMAN} Public Static voidshowsex (Enumsex enumsex) {Switch(enumsex) { CaseMAN:System.out.println ("This was a boy"); Break; CaseWOMAN:System.out.println ("This is a girl"); Break; } } Public Sta
implemented at the same time. You are also offered the Equals () and Hashcode () methods on your own initiative.In addition to being unable to inherit an enumeration class, we can basically think of an enumeration class as a regular Java class, with the ability to add new methods to it, including abstract methods and even the main method.Now we use enumerations to implement the gender function above. Public enumEnumsex {man, WOMAN} Public Static void
(byte[] buf,int offset,int len);Specifies the source of the byte input stream in the constructor parameterMethods to read from the stream:public int read (), which reads a byte from the source, which returns a byte value.public int read (byte[] buf) that reads bytes from the source into the parameter buf, which returns the number of bytes actually read out. If no bytes are read, return-1Similarly: byte array output stream Bytearrayoutputstream (), parameter optional int type byte size, default
the parent delegation model, where a classloader receives a request for class loading, is first delegated to the parent ClassLoader to complete, all load requests are routed to the top-level startup ClassLoader, and if the parent ClassLoader feedback fails to complete the load request, it continues to be loaded by the subclass.The benefit of this load is that the Java class has a hierarchical relationship with precedence over its classloader, avoidin
multiple interfacesNote: (1) The method in the interface is the abstract public abstraction by default , and there is no ordinary method; (2 Class access interface must be overridden or defined as an abstract class Inner classWith good separation, internal classes can access data from external classes without restrictions, including private properties and methods. And can have been public,private,static and other modifications. When a class does not have a static modifier, the inner cla
rely on the counter.
(2) Counter and multithreading
Because multiple threads of the JVM are switched by thread and assigned processor execution time in any given moment, a processor (a kernel for a multi-core processor) executes only the instructions in one thread. Therefore, in order to return to the correct execution position after the thread switch, each thread needs a separate program counter, the counter between the threads does not affect each
found that when using a generic class, though the different generic arguments were passed in, but there is no real sense of generating different types, the generic classes passed in different generic arguments have only one memory, that is, the original most basic type (what type of object is new and what type is it in memory), and of course, Logically we can understand several different generic types.
The reason is that the concept of generics in Java
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.