Introduction: In our process of learning Java, grasp the basic concepts on which our study both J2SE, J2EE, J2ME is very important, J2SE is the Java-based, so it is necessary to do the basic concept of which to draw conclusions, for all subsequent learning process in a better understanding of the essence of java, and I summed up the 30 basic concepts.
Java Overview:
Currently Java is mainly used in the development of middleware (middleware) --- processing between the client server communication technology in the early proved, Java is not suitable for pc application development, and its development has gradually developed into the handheld device Internet kiosks, and the development of onboard computer. Java is different in other languages is to provide a platform for running the independence of praise in windows, solaris, linux other operating systems use the exact same code. Java's syntax and syntax similar to C + +, C + + / C programmer is very easy to master, and a complete Java is completely object-oriented, which made a very good GC (GarbageCollector) waste disposal mechanism to prevent memory overflow.
Java White Paper for the Java language, we propose 11 key features.
(1) Easy: Java syntax than C + +, relatively simple, the other aspect of Java allows software to run the machine in a small, basic explanation and support of library is about the size of 40kb, to increase the basic standard libraries and support the need to increase the memory thread 125kb.
(2) Distributed: Java with a very strong TCP / IP protocol suite in the routine library, Java applications can come through the URL to access remote objects through the network, due to the emergence of servlet mechanism to enable Java programming more efficient, Now many of the major webserver support servlet.
(3) OO: object-oriented design is to focus on the object and the object of a programming interface. Its object-oriented and C + + there are many different treatment with multiple inheritance and the original Java class model.
(4) robust features: Java pointer to a security model, can reduce the memory and data rewriting the possible collapse of type
(5) Security: Java to design network and distribution system, which brings new security issues, Java can be used to build an anti-virus and anti-attack of the System. The fact that Java in anti-virus do better in this regard.
(6) neutral architecture: Java compile the generated architecture neutral object file format can be run on many processors, the compiler produces byte-code instructions (Javabytecode) to achieve this feature, this byte code can be on any machine interpreted.
(7) Portability: Java in the types of basic data structures and algorithms have strict size requirements so good portability.
(8) Multi-threading: Java multi-threaded process is simple, Java to multi-threaded operating system or thread to achieve under the process to complete. So, is Java as a multi-threaded server-side development language is one of the reasons
(9) Applet and servlet: able to perform the procedures in the page called Applet, Java browser needs to support many, and applet support dynamic web pages, this is a lot of other languages can not do.
Basic concepts:
1.OOP the only relationship is what the interface object, like a computer power supply vendors within the structure of her no matter what, he can only give you the power relations on the line, that is, as long as that canornot not howandwhy . All the procedure is for certain properties and behavior of objects, different object access through the function call to complete, all the communication between objects is through method calls, through the package object data, improve the complex with a great extent Shang rate.
2.OOP the most important idea is that class, the class is the template is the blueprint for an object from the class structure, which creates an instance of this class (instance)
3. Package: is to combine data and behavior from a package) and an object hidden data in the realization of the user, the data in an object instance called his field (instancefield)
4. By extending a class to get a new class called inheritance (inheritance), and all the classes are extended from the Object root superclass are derived from the root super-class description below will do.
5. The object of the three main features
behavior --- illustrate the object can do.
state --- put method when the object reflects the object.
identity --- the object of conduct and other similar distinguishing mark.
Each object has a unique indentity and the interaction between these three.
6. The relationship between classes:
use-a: dependence
has-a: aggregation
is-a: inheritance - Cases: A class inherits class B, then A class not only have a B class methods, as well as its own method. (found in common in personality)
7. Tectonic object using the constructor: constructor make, constructor is a special way, construct the object and its initialization.
Cases: Data class constructor is called Data
newData ()--- construct a new object, and initialize the current time.
Datahappyday = newData ()--- to assign an object to a variable happyday, so that the object can be repeatedly used, here to declare the object variable to the variable and the two are different. New return value is a reference.
Structure Features: constructor can have 0, 1 or more parameters
Constructor and the class have the same name
A class can have multiple constructors
Constructor does not return value
Constructor and the new operator is always used together.
8. Overload: When multiple methods with the same name but with different parameters, they place heavy. Compilers which method must be selected call.
9. Package (package) Java allows collection of one or more classes together into a group, called the package in order to facilitate organizational tasks, the standard Java library is divided into a number of packages. Java.langjava.utiljava, net, etc., including a sub- levels of all the java packages in java and javax package level within.
10. Inherited ideas: allow existing classes to build new classes based on when you inherit an existing class, then you reuse this class of methods and fields, and you can in the new class Add new methods and fields.
[Next]
11. Extension classes: extended type of fully reflect the inheritance relationship is-a. In the form: class (subclass) extends (base class).
12. Polymorphic: in java, the object variable is polymorphic. But java does not support multiple inheritance.
13. Dynamic binding: object method call mechanism.
(1) declaration compiler checks the type of object and method names.
(2), the compiler checks method call parameter types.
(3) static binding: If the method type priavtestaticfinal compiler will know exactly which way the call.
(4) When the program runs and uses dynamic binding to call a method, then the virtual machine must call an object x points to match the actual type of method versions.
(5) dynamic binding: It is very important feature, which enables process becomes scalable without the need to recompile the code has been kept.
14.final categories: To prevent other people from your new class, derived class, such is not extended.
15. Dynamic invocation time spent than static calls longer.
16. Abstract class: provides one or more abstract methods of the class itself must be defined as abstract
Cases: publicabstractstringgetDescripition
17.Java Each class is extended from the Object class came.
18.object class equal and toString methods.
equal for testing whether an object with another object equal.
toString returns a string representing the object, almost every class will override this method to return the current state of the right said.
(ToString method is a very important method)
19. General Programming: Any class type of all values can be the same object class of variable instead.
20. Array list: ArrayList list, dynamic arrays, a library, defined in the java.uitl package can automatically adjust the size of the array.
21.class class object class getclass method returns an instance of ckass type, the program starts in the main method that contains the class will be loaded, the virtual confidential load all the classes he needs, each class must be loaded load the class it needs.
22.class class to write java code dynamic manipulation program provides powerful reflection, this function is to use JavaBeans in particular the use of Java reflection to support VB programmers used to using the tool.
Ability to analyze procedures class called Reflector, Java provides this functionality in a package called Java.lang.reflect reflection is very strong.
1. In the run-time analysis of class ability.
2. In the run-time object of exploratory classes.
3. To achieve common array manipulation code.
4. Provide a means object.
The main target of this mechanism is a tool and not the applications and procedures.
Reflection of the most important part is to allow you to check the class structure. Use of the API are:
java.lang.reflect.Field return to the field.
java.reflect.Method return method.
java.lang.reflect.Constructor return parameters.
Method pointer: java there is no way pointer to the address of a method to pass another way, you can call it back, but interface is a better solution.
23. Interface (Interface) instructions do not specify how to do class, a class can implement one or more of the interface.
24. Interface not a class, but to meet the interface requirements of the class of a set of norms.
If the realization of an interface requires two steps:
1. Statement class needs to implement the specified interfaces.
2. Provides all the methods of the interface definition.
Declare a class implements an interface need to use the implements keyword
classactionBimplementsComparable its actionb need to provide CompareTo method, the interface is not a class, can not use new instance of an interface.
25. A class is only one super class, but a class can implement multiple interfaces. Java is an important interface,
Cloneable
26. Interface and callback. A common programming model is the callback model, in this mode you can specify a specific time occurs when the callback method of the object.
Cases: ActionListener interface to monitor.
API are similar: java.swing.JOptionPane
java.swing.Timer
java.awt.Tookit
27. Object clone: clone method is a protected object, which means your code can not simply call it.
28. Internal Class: A class is defined within the definition of the class in another internal
The reason is: 1. An inner class object can access the realization of the object that created it, including the private data
2. For the same package for the other classes, inner classes can be hidden.
3. Anonymous inner classes can be easily defined callback.
4. Using internal type can be very convenient to write event-driven process.
29. Proxy class (proxy): 1. All of the code specified interface requirements
2.object class defines all methods (toStringequals)
30. Data type: Java is the stress type of language, each variable must declare it before all types, java in a total of eight basic types of .4 species is an integer, 2 is a floating-point type, one is char was used for Unicode character encoding, Boolean.
Recommended links:
Money crowd and Chow's relayLi Yuzhuo: work does not bring happiness to lose its significanceAVI To MOVhow to Calibrate laptop batteryGGhost a key recovery 09.03.08Opened a pack of genuine secret Behind the Win 7Review Animation ToolsDivX to 3GPMOV TO MPEG4How to revive the old floppy drive?EBiz.scm IntroductionIs Out Of Date, ADSL AnecdotesJSP Servlet automatically jump to the wrong instance of the pageGood E-CommerceReview Fax Tools