Preface: In the process of learning Java, master the basic concepts to our learning, whether it is J2SE, J2EE, J2ME, J2SE is the foundation of Java, so it is necessary to summarize the basic concepts. So everyone better understands the essence of Java in the future learning process, I summarized 30 basic concepts. Java Overview: The current Java is mainly used in the middleware development (MiddleWare) --- dealing with clients Communication technology, early practice prove, Java is not suitable for the development of PC applications, and its development has gradually become developed in the development of handheld equipment, Internet information stations, and car computer. Java is different from other languages. The standing independence is provided, which is known to use the exact same code on Windows, Solaris, Linux other operating systems. Java syntax is similar to C syntax, and C / C programmers are easy to master, and Java is completely thorough. Object-oriented, which proposed a good GARBAGE COLLEctor's garbage handling mechanism to prevent memory overflow. Java's white paper proposes 11 key features of Java language. (1) Easy: Java's grammar is relative to C Simple, another aspect is that Java can run software on a small machine, the basis explains its support for its support for the support of the class, adding basic standard libraries and thread supported memory needs to increase 125KB. (2) distribution : Java has a strong routine library of TCP / IP protocols, Java applications can pass the network through the URL to access remote objects, due to the appearance of the servlet mechanism, making Java programming very efficient, now many big Web Server supports servlet. (3) oo: Object-oriented design is a programming technology on an interface of objects and objects. Its object-oriented and C have a lot of different, with multiple inheritance and Java's original Class model. (4) Running characteristics: Java adopted a security pointer model that reduces the possible type (5) security of rewriting memory and data crash: Java is used to design a network and distribution system, which brings new Security issues, Java can be used to build anti-virus and anti-attack System. Facts to prove that Java is better in the Anti-Virus. (6) Neutral architecture: Java compiles its generating architecture neutral target file format can be in many The processor is executed on the processor, the Javabytecode generated by the compiler implements this feature, which can be explained on any machine. (7) Portability: Size and algorithm for the basic data structure type in Java There is a strict regulations, so the portability is very good. (8) Multi-thread: Java processing multi-thread process is very simple, Java put Multi-thread implementation is handed over to the operating system or thread program. So multithreading is one of the popular reasons for Java as a server-side development language (9) Applet and servlet: The program that can be executed on the web page is applet, you need to support Java browsing A lot of more, and Applet supports dynamic web pages, this is what many other languages cannot be done.
Basic Concept: 1. The only relationship in OOP is what the object's interface is, just like the computer's seller, she doesn't matter if the internal structure of the power supply, he only does it give you electricity, but just know if CAN or NOT instead of how and why. All programs are composed of certain properties and behavior objects, different objects access through function calls, all exchanges between objects are called by way of ways, through the package object data, very Larger recession increases .2. The most important idea in OOP is class, class is a template is a blueprint, constructed an object from the class, which creates an instance of this class (Instance) 3. Package: That is to put data In combination with behavior in a package) and the implementation process of the object user hide the data, the data in an object calls his instance field 4. By expanding a class to get a new class called inheritance (inheritance) And all classes are extended by Object root superclass, and the root super class will be introduced. 5. 3 main features of the object Behavior --- Description This object can do .State --- When the object is applied The method of the method is reflected. Identity --- distinguished from other similar behavior objects. Each object has unique INDENTITY and the three interacts between these three. The relationship between classes: use-a: Dependence HAS -A: Polymerization Relationship IS-A: Inheritance Relationship - Example: A Class A inherited Class B, at which time A category not only has Class B, but also its own method. (personality exists in commonality) 7. Construction object uses a constructor: The constructor is proposed, the constructor is a special method, constructing the object and initializes it. Example: Data class constructor called DataNew Data () --- Construct a new object, and initialize the current Time .DATA happyday =
NEW data () --- assigns an object to a variable happyday, so that the object can be used multiple times, and the value of the variable and the object variable is different. NEW returns is a reference. Construction Features: The constructor can have 0, one or more parameter constructors and the same names, and a class can have multiple constructors, and there is no return value constructor to always use it together with the New operator. 8. Load: When multiple methods have the same name and contain different parameters, the compiler must select which method of calling .9. Package Java allows one or more classes to become together Group, called packets to facilitate organizational tasks, standard Java libraries are divided into many packages .java.lang java.util Java, NET, etc., package is all Java packages in Java and JavaX package. 10. Inheritance ideas: Allow new classes on the basis of existing classes, when you inherit an existing class, then you have multiplexed this class, and you can add new categories. Methods and fields .11. Extended class: Extended class fully reflects the inheritance relationship of IS-A. Form is: Class (Subclass) Extends .12. Polymorphism: In Java, the object variable is polymorphic Multiple inheritance is supported in Java. 13. Dynamic Binding: Mechanism of calling an object method. (1) The compiler checks the type and method name of the object declaration. (2) The compiler check the parameter type. (3) Static Binding: If the method type is the Priavte Static Final compiler, it will accurately know which method is called. (4) When the program runs and uses a dynamic binding to call a method, then the virtual machine must call the actual object to which X points to the object. Method version of the type matching. (5) Dynamic Binding: It is very important to make the program becomes scalable without need to recompile the modified code. 14.final class: To prevent others from from your class Delicious new categories, this type is not expandable .15. Dynamic calls are longer than static calls. Each class in Java is extended from the Object class. 18.Object class Equal and toString method. Equal is used to test if an object is equal to another object. TOSTRING returns a string representing the object, Almost every class will overload the method to return the correct representation of the current state. (Tostring method is a very important method) 19. Universal programming: All values of any class type can be classified with Object Variables instead .20. Array List: ArrayList Dynamic Array List, is a class library, defined in the Java.uitl package, automatically adjust the size of the array. 21. The getClass method in the Class class Object class returns an instance of the CKASS type When the program starts, the class containing the main method will be loaded. If the virtual machine is loaded with all the classes he need, each loaded class must load the class it needs .22.class class is a program to perform a dynamic manipulation Java code Provide powerful feature reflection, this feature is especially useful for JavaBeans, using reflection Java to support VB programmers used to use tools. You can analyze the ability of the programming reflector, Java provides this feature package java.lang. The Reflect reflection mechanism is very powerful. 1. The ability to analyze class at runtime. 2. Object of the class at runtime. 3. Implement universal array manipulation code. 4. Provide method objects. This mechanism is mainly toolbeats rather Applications and procedures. The most important part of the reflective mechanism is to allow you to check the structure of the class. The use of the API is: java.lang.reflect.field Return to the field .java.Reflect.Method Return to the method .java.lant.reflect. Constructor Returns the parameters. Method pointer: Java has no method pointer, passes the address of a method to another, you can call it later, and the interface is a better solution. 23. Interface (interface) What should I do? Don't specify how to do it, a class can implement one or more interface.24. The interface is not a class, but a set of specifications for classes that meet the interface requirements. If an interface requires 2 steps: