programming support, declarative transaction support, easy program testing, easy integration of various excellent frameworks and so on. f) To sum up,Spring has the following advantages:I. Low-intrusive design with very low code contaminationIi. commitment to Write Once,run anywhere , independent of various application serversIii. Spring's DI (Dependency injection) mechanism reduces the complexity of business object substitution Iv. Spring is not enti
nested classes NOTE: * Nested classes are created directly from new * in a nested class, you cannot access the non-static members of an external class like a normal inner class * can have s in nested classes Tatic method, this is not allowed in different inner classes. */classstaticclass{Private intnum; Private Static intsum=2; Public Static classstaticinnerclass{ Public intGetnum () {returnsum; } }}/** * Why internal class * A, inner class provides some kind of window into the outer class.
problem? What can I do if I want to make the assignment right? What is the result? Exercise: Byte B = (byte);*/Public classText { Public Static voidMain (string[] args) {//because the range of byte is:-128 to 127. //and 130 is not within this range, so error. //byte B = 130; //We can use forced type conversions byteB = (byte) 130; //How much is the result?System.out.println (b); }}/*Analysis Process: If we want to know what the result is, we should know how to calculate it. And we
the same variable can is tracked down at a code level. To being able to know if independent variables share the same cache line we need to know the memory layout, or we can get a T Ool to tell us. Intel VTune is such a profiling tool. In this article I'll explain how memory was laid out for Java objects and how we can pad out our cache lines to avoid false Sharing.In multi-processor, multi-threaded scenari
; intn=count; if (N==anotherstring.count) { charv1[]=value;charv2[]= anotherString.value;inti=offset; intj=anotherString.offset; while (n--!=0) {if (v1[i++]!=v2[j++]) returnfalse;} returntrue;}} returnfalse;} 3, String other considerations1), the string has no attribute exposure, the internal property is generally private and final type, such as offset, count, value; 2), the string rewrite the Equals method, then also must rewrite the Hashcode method; 3), the string cannot be inherited because
inheritance.because the interface defines a specification, the interface cannot contain constructors and initialization block definitions. The interface can contain member variables (only static constants), methods (only abstract instance methods, class methods (1.8), or Default methods (1.8)), and internal classes (including internal interfaces, enumerations) are defined.The system automatically adds the public static final modifier to the member variables in the interface.So the definition of
First, this; class variable/class method1.this: Used to differentiate between properties in a constructed method (only used internally)2. Class variable: (access modifier) static data type variable nameAccess method: Class name. Variable name (or object name). Class variable name)3. Class method: (access modifier) static data type variable nameAccess method: Class name. The class method name (or object name). class method Name)Second, encapsulation: access modifiers:Iii. Inheritance: Resolving
1, because what type of elements in the collection can be stored. Causes the run-time classcastexception to be raised if a strong turn occurs. How to solve this problem? When you use a collection, you must explicitly specify the type of the elements in the collection. This approach is called: Generics.2, the application of generics is divided into three kinds: the class containing the generic type, containing the generic interface, containing a generic method.3. When generics are used, define th
notify ()
Wait (XXX) when the corresponding notify () is called or exceeds the specified time, the thread will go into the ready state
Wait () will only enter the ready state if the corresponding notify () is called
Suspend () and resume ()Suspend () causes the thread to enter a blocking state and is not automatically restored. Only when the corresponding resume () is invoked will it enter the ready state
Yield ()Causes the thread to discard the currently acquire
employees of the company, programmers and managers can be extracted. Establish the system. *///describe the employee. Abstract classemployee{PrivateString name; PrivateString ID; Private DoublePay ; Employee (String name,string ID,DoublePay ) { This. Name =name; This. ID =ID; This. Pay =Pay ; } Public Abstract voidWork (); }//describe the programmer. classProgrammerextendsemployee{Programmer (String name,string ID,DoublePay ) { Super(Name,id,pay);//the instantiation of the
exceptions for programming errors 59th: Avoid unnecessary use of the exception that is examined 60th: try to use the standard exception 61st: throws an exception corresponding to the abstract 62nd: All exceptions thrown by each method must have a document 63rd: contains the failure-capture information in the detail message 64th: Try to keep the failure in the Atomic 65th Bar: Do not ignore exceptions chapter 10th Concurrent 66th: Synchronizing access to shared variable data 67th: Avoid too many
Multithreading concurrent programming is an important piece of Java programming, is also the focus of the interview area, or it is worth in-depth studyConcept:1 Threads: Execution units in a process responsible for program executionThe thread itself relies on the program to runThreads are sequential control flows in a program and can only use resources and environments that are assigned to programs2 process: Executing the programA process contains at
in the lock flag waiting pool, and only the lock flag waits for the thread to acquire the lock flag, and notify () does not work if there are no threads in the lock flag waiting pool.Notifyall () removes all the threads waiting for that object from the object waiting pool and puts it in the lock flag waiting pool.Note that these three methods are java.lang.Object methods.5, run and start ()Put the code that needs to be processed into the run () metho
;===============================================================================================================Multi-Table query:
Ways to query Multiple tables:
* Cross Connection:* SELECT * from a B; ---obtained is the Cartesian product of two tables.* Inner Connection: INNER JOIN--inner can be omitted* Explicit Intra-connection: SELECT * from A inner join B on condition;* SELECT * FROM customer C INNER JOIN orders o c.cid = o.cid;* Implicit internal connection: SELECT * from a a
One.Review Operators:Add : ternary operator. Code:/*Three-mesh operators:Ternary operators:Structure:conditions? The result of condition establishment : The result that the condition is not established ;*/Class Demo1{public static void Main (string[] args){int a = 10;int B = 9;int c = b++>=a? a++: B+a;System.out.println (a); 10System.out.println (b); 10System.out.println (c); 20}}two. Control Statements1.1 Sequential structure ( most common ) Feature
Basic Concepts1. Identifier: consists of letters, underscores, numbers, dollar signs, but cannot start with a number.2, Keywords: 50 keywords, goto Although does not exist, but still is the keyword3, Variable: its naming specification is not necessarily according to the identifier, it can be Chinese and so onData Type1, Java A total of 8 native data types (another is reference type), can be divided into four groups1) Logic Type: Boolean2) Character ty
class is character, the Boolean type encapsulation class is Boolean, They all provide functions that replace the string type with the corresponding base type. (1) Convert string to int type Integer.parseint (string) (2) Convert string to Float type Float.parsefloat (string) (3) Converts a string to a Double type double.parsefouble (string) Instance code:
Package Typeconverttest;public class typeconverttest{public static void Main (s
Java technology improvement, review, and summary (2)
Next reflection:
Array reflection, also see the code comprehension:
int [] a1 = new int[]{1,2,3};int [] a2 = new int[4];int[][] a3 = new int[2][3];String [] a4 = new String[]{"a","b","c"};System.out.println(a1.getClass() == a2.getClass());System.out.println(a1.getClass() == a4.getClass());System.out.println(a1
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.