30 basic concepts of Java entry (reproduced)

zhaozj2021-02-16  193

Java Overview: Currently Java is mainly used in the development of middleware --- Processing communication technology between clients, early practice proves that Java is not suitable for the development of PC applications, and its development has gradually become developed The development of handheld devices, Internet information stations, and car computer. Java is different from other languages ​​that provide the stand-independence of the platform when the program is running, which is highly identical to the exact same code on Windows, Solaris, Linux other operating systems. Java The syntax is similar to the C syntax, and the C / C programmer is easy to master, and Java is a completely thorough object-oriented, which proposes a good GARBAGE COLLEctor waste handling mechanism to prevent memory overflow. Java's white paper proposed 11 key features in Java language. (1) Easy: Java's grammar is relatively simple than C , and another aspect is that Java can run software on a small machine, the basic explanation of its support for the support of its support is about 40KB, increasing basic standard libraries and The memory supported by thread needs to increase 125KB. (2) Distributed: Java has a very powerful routine library of TCP / IP protocol, and Java applications can pass the network through the URL to access the remote object, due to the appearance of the servlet mechanism, making Java programming very efficient, Now many large web server support servlet. (3) OO: Object-oriented design is a programming technology on an interface of objects and objects. It has a lot of object-oriented and C , in relation to multiple inheritance and the original model of Java. (4) Runtight: Java adopted a safety pointer model to reduce possible types of rewriting memory and data crash. (5) Safety: Java is used to design a network and distribution system, which brings new security issues, and Java can build antivirus and anti-attack SYSTEM. Facts prove that Java is better in this area of ​​the Antirate. (6) Neutral Architecture: Java compiles its generating architecture neutral target file format can be executed on many processors, and the compiler generated command bytecode (Javabytecode) implements this feature, this byte code can be on any machine Explanation execution. (7) Portability: The size and algorithm of the basic data structure type in Java have strict regulations, so the portability is very good. (8) Multithread: Java processing multi-threaded process is simple, Java is handed over to the bottom operating system or thread program to complete the multi-thread implementation. 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 called Applet, which needs to support a lot of browsers in Java, and Applet supports dynamic web pages, which 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 Maximum reuse rate is large. 2. The most important idea inoo is class, class is a template is a blueprint, constructed from the class, which is created an instance of this class (Instance). 3. Package: Incoming data and behavior in a package) and the implementation process of the object user hides the data, and the data in an object calls his instance field. 4. By expanding a class to get a new class called inheritance, and all classes are extended by Object roots, and the root super class will be introduced. 5. Three main features of the object Behavior --- Description This object can do. State --- Reflection of the object when the object is applied. Identity --- distinguish between the other similar behavior objects. Each object is unique Indentity and these three are mutually influential. 6. The relationship between class: USE-A: Dependence HAS-A: Polymer Relationship IS-A: Inheritance Relationship - Example: A Class A inherited Class B, at this time Class A not only has a method B method, but also its own method. (Personality exists in a commonality) 7. Construction object uses a constructor: The presentator is proposed, the constructor is a special method, constructing the object and pair It is initialized.

Example: Data class constructor called Data New Data () --- Constructs a new object and initializes the current time. Data happyday = new data () --assign an object to a variable happyday, thus enable the object Multiple use, which is required to declare that the value of the variable and the object variable is different. NEW returns is a reference. The constructor features: the constructor can have 0, one or more parameter constructors and the same names, and a class may have a plurality of constructor constructors without the return value constructor to always be used with the New operator. 8. Overload: When multiple methods have the same name and contain different parameters, the overload occurs. The compiler must select which method of calling. 9. Package Java allows one or more classes to become a group, called packets to facilitate organizational tasks, standard Java libraries are many packages .java.lang java.util Java, NET, etc. It is all Java packages in the Java and Javax package. 10. Inherited Thoughts: Allow new classes on the basis of existing classes, when you inherit an existing class, then you have multiplexed the methods and fields of this class, and you can add it in the new class. New 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 polymorphically. Multiple inheritance is not supported in Java. 13. Dynamic Binding: Mechanism of calling an object method. (1) The type and method name of the compiler check the object declaration. (2) The compiler checks the parameter type called by the method. (3) Static binding: If the method type is the Priavte Static Final compiler, which method will be accurately known. (4) When a program is running and using a dynamic binding to call a method, then the virtual machine must call the method version of the actual type of object to which X points to the X. (5) Dynamic binding: It is very important to make the program become scalable without need to recompile the filed code. 14.Final Class: In order to prevent some people from derived new categories from your class, this type is not expandable. 15. Dynamic calls are longer than static calls. 16. Abstract class: The class that specifies one or more abstract methods must be defined as Abstract. Example: Public Abstract string getDescripition17.java is extended from the Object class. 18. Equal and toString methods in the Object class. Equal is used to test whether an object is equal to another object. Tositring returns a string representing the object, almost every class overloads the method to return the correct representation of the current state. (Tostring method is a very important method) 19. General programming: All values ​​of any class type Can be replaced with the Object type variable. 20. Array List: ArrayList dynamic array list, is a class library, defined in the java.uitl package, automatically adjusts 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 is started, the class containing the main method will be loaded. The virtual machine should load all the classes he need, and each loaded class is loaded. the type. 22. The Class class provides powerful functional reflection for programming programming that can dynamically manipulate Java code. This feature is especially useful for Javabeans, using reflection Java to support VB programmers used to use. The programming reflector that is able to analyze the capabilities, and the package of this feature in Java is very powerful. 1. The ability to analyze class at runtime. 2. Explore the object of the class at runtime. 3. Implement universal array manipulation code. 4. Provide method objects. This mechanism is primarily targeted by tools rather than 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.lang.Reflect.constructor Returns the parameters. Method pointer: Java has no method pointer, passing the address of a method to another, can call it later, and the interface is a better solution. 23. Interface indicates what the class does not specify how to do it, and a class can implement one or more interface.

转载请注明原文地址:https://www.9cbs.com/read-7867.html

New Post(0)