Study 30 basic concepts in the J2SE (from 9cbs.net)

xiaoxiao2021-03-06  122

Learning 30 basic concepts in the J2SE process

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 garbage handling mechanism to prevent memory overflow. Java's white paper proposes 11 key features of 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 security 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 handles multithreaded procedures, Java is completely handed over to the bottom operating system or thread program. So multithreading is one of the popularization causes of Java as server-side development languages.

(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 blueprint, constructed from the class, which creates 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, the data in an object calls his instance field (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 is interacting between these three.

6. Relationship between class: use-a: Dependencies HAS-A: Aggregation Relationship IS-A: Inheritance Relationship - Example: A Class A inherited Class B, at this time, Class A is not only a method B, but also Have its own method. (Personality exists in a commonality) 7. Construction object uses a constructor: presentation, constructor is a special method, constructing an object and initializes it. Example: Data class constructor called Data new data () --- Constructs a new object and initializes the current time. Data happyday = new data () - The object assigns an object to a variable happyday, so that the object can be used multiple times, here must declare The value of the variable and the object variable is different. NEW returned by the value is a reference. Constructor features: There are 0 constructors, one or more parameter constructors and the same names can have multiple classes. The constructor constructor does not return a value constructor always used with the New operator.

8. Overload: When multiple methods have the same name and contain different parameters, it is overloaded. 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: Call the mechanism of the object method. (1) The compiler checks the type and method name of the object declaration. (2) Parameter type of the compiler check method call. (3) Static binding: If the method is priavte The Static Final compiler will accurately know which method of the call. (4) When the program runs and uses a dynamic binding to call a method, then the virtual machine must call the actual type of object to which X points to the object. (5). ) Dynamic Binding: It is very important to make the program becomes expandable without recompilation that has been saved.

14.Final Class: In order to prevent some people from derived new categories from your class, this type is not expandable.

15. Dynamic calls have taken longer than static calls,

16. Abstract class: The class specifies that one or more abstract methods itself must be defined as Abstract: Public Abstract String getDescripition

17. Each class in Java is expanded from the Object class.

18. Equal and toString methods in theobject class. Equal is used to test whether an object is equal to another object. TOSTRING returns a string representing the object, almost every class overloads the method in order to return the correct state. Indicates. (Tostring method is a very important method)

19. Universal Programming: All values ​​of any class type can be replaced with the object class 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. 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 tools. Campaign to analyze the ability to call reflectors The package of this feature in Java is very powerful. 1. The ability to analyze classes at runtime. 2. Objects of the class at runtime. 3. Implement universal array manipulated code. 4. Provide Method object. This mechanism is primarily for tools rather than applications. The most important part of the reflex mechanism is to allow you to check the structure of the class. The API used by: java.lang.reflect.field returns field. Java. .reflect.method Return method. Java.lang.reflect.constructor Returns the parameter. Method pointer: Java has no method pointer, pass the address of one method to another, you can call it later, and the interface is better solution .23. Interface indicates what the class does not 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: 1. The specified interface that needs to be implemented. 2. Provides the definition of all the methods in the interface. Declare a class to implement an interface. You need to use the imports keyword Class Actionb IMPLEMENTS Comparable. It is necessary to provide a CompareTo method. The interface is not a class, and an interface cannot be instantiated with a New.

25. A class has only one superclass, but a class can implement multiple interfaces. An important interface in Java Cloneable

26. Interface and callback. Programming a common mode is a callback mode. In this mode you can specify a method on the callback object when a specific time occurs. Example: ActionListener interface monitors. Similar APIs are: java.swing. JOPTIONPANE JAVA.SWING.TIMER JAVA.AWT.Tookit

27. Object Clone: ​​Clone method is Object a protection method, which means that your code cannot be simply call it.

28. Internal Class: One internal class definition is that the reason for defining another internal class is: 1. An internal class object can access the implementation of the object that creates its object, including private data 2. For other classes in the same package For the internal classes, the internal class can be hidden. 3. Anonymous internal classes can be easily defined. 4. Use the internal classes to write event drivers very convenient.

29. Proxy (Proxy): 1. Specify all the methods defined by all code 2.Object class (TSTRING Equals)

30. Data Type: Java is emphasized the type of language, each variable must first declare that it is type, there are 8 basic types in Java. 4 is integer, 2 is a floating point, one is a character type , Which is used in the Unicode encoding characters, Boolean.

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

New Post(0)