Java has become a huge and complex technology platform for developers, especially those who have just started to learn, to better grasp Java technology, to understand the basic concepts in depth is indispensable, can help you to improve the understanding of Java. Here's a description of the 11 key features and 30 basic concepts of the Java language.
One, 9 key features of the Java language.
(1) Easy:java's syntax is relatively simple compared to C + +, and one aspect is that Java enables software to be executed on very small machines, with the basic explanation that the size of the support for its and class libraries is approximately 40kb, adding 125kb to the main standard library and the memory required for threading support.
(2) Distributed: Java has a very powerful TCP/IP protocol. Java applications can access remote objects through a URL through the network, because the advent of the servlet mechanism makes Java programming very efficient, and today many large Web servers support Servlets.
(3) OO: Object-oriented design is a programming technique that focuses on the interface of objects and objects. Its object-oriented and C + + have very many differences in the processing with multiple inheritance and the original class model of Java. Oo:object oriented object-oriented.
(4) Robust features: Java takes a secure pointer model that reduces the potential for rewriting memory and data crashes.
(5) Security: Java is designed to design networks and distributed systems, which introduces new security issues that Java can use to build anti-virus and anti-attack system. It turns out that Java is doing better in this aspect of antivirus.
(6) Neutral architecture: Java compiles its generation architecture-neutral target file format to run on very many processors, compiler-generated instruction bytecode (Javabytecode) to implement this feature, which can be interpreted on any machine.
(7) Portability: Java has strict rules on the size and algorithm of basic data structure types, so portability is very good.
(8) Multithreading: The process of multithreading in Java is very easy,java the implementation of multithreading to the following operating system or thread completion. So multithreading is one of the popular reasons for Java as a server-side development language. "Basics of threading"
(9) Applets and Servlets: Programs that can be run on a Web page are called applets, there are a lot of browsers that need to support Java, and applets support Dynamic Web pages, which is something that many other languages cannot do. "This is now basically out of use."
Second, the basic concept:
The only thing that concerns the 1.OOP is what the object's interface is, like a computer vendor. Regardless of the internal structure of the power supply, whether or not he can provide you with electricity, just know can or not rather than how and why. All the programs are composed of a certain property and the behavior of the object, the access of different objects through the function of the call to complete, all the communication between objects through the method calls, through the encapsulation of the object data, greatly increased the reuse rate.
The most important idea in 2.OOP is the class, the class is the template is the blueprint, constructs an object from the class, namely creates an instance of this class (instance).
3. Encapsulation: is to combine data and behavior in a package, and to hide the data for the object user implementation process, the data in an object called his instance field (instance field).
4. By extending a class to obtain a new class called Inheritance (Inheritance), all classes are extended by the object root superclass, and the root superclass is described below.
5.3 main features of an object
Behavior---Explain what this object can do.
State---The object's reflection when the object imposes a method.
Identity---A distinguishing token from other similar behavior objects.
Each object has a unique indentity and these 3 are influenced by each other.
6. Relationships between classes:
USE-A: Dependencies
Has-a: Aggregation Relationship
Is-a: Inheritance Relationship--Example: Class A inherits Class B, at which point a class has not only the method of Class B, but also its own method. (Personality exists in commonness)
7. Construct objects using constructors: Constructors are proposed, constructors are a special method of constructing objects and initializing them. Example: The constructor of the data class is called the Data New data ()---Constructs a new object and initializes the current time. Data happyday=new data ()---assigns an object to a variable happyday, so that the object can be used more than once, where the variable to be declared differs from the object variable. The value returned by new is a reference. Constructor features: The constructor can have 0, one or more parameters (assuming that the constructor is not written, the default has a non-participating constructor, so the constructor is actually at least one.) Constructors and classes have the same name as a class that can have multiple constructor constructors without a return value the constructor is always used with the new operator.
8. Overloading: Overloading occurs when multiple methods have the same name and different parameters are included. The compiler must pick which method to call.
9. Package Java agrees to gather one or more classes together as a group, called packages, to facilitate the organization of tasks, and the standard Java library is divided into many packages. Java.lang Java.util java,net and so on, packages are hierarchical and all Java packages are within the Java and Javax package hierarchy.
10. Idea of succession: agree to build new classes based on existing classes, and when you inherit a class that already exists, you reuse the methods and fields of the class, and at the same time you can add new methods and fields to the new class.
11. Extension classes: The extension class fully embodies the inheritance of is-a. The form is: Class (subclass) extends (base class).
12. Polymorphism: In Java, the object variable is polymorphic. Multiple inheritance is not supported in Java.
13. Dynamic binding: A mechanism for invoking object methods.
The compiler checks the type and method name of the object declaration.
The compiler examines the type of the method call's number of parameters.
Static binding: If the method type is priavte the static final compiler will know exactly which method to call.
When a program executes and uses dynamic binding to invoke a method, the virtual machine must call the method version number that matches the actual type of the object that X points to.
Dynamic binding: A very important feature that enables programs to be extensible without the need to recompile existing code.
14.final class: To prevent others from deriving new classes from your class, this class is not extensible.
15. Dynamic calls take longer than static calls.
16. Abstract class: A class that prescribes one or more abstract methods must itself be defined as abstract. Example: Public abstract string Getdescripition
Each class in 17.Java is extended from the object class.
The equal and ToString methods in the 18.object 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 to return the correct representation of the current state. (The ToString method is a very important method)
19. Universal Programming: No matter what type of all the values can be substituted with the object class variable.
20. Array list: ArrayList dynamic array list, is a class library, defined in the JAVA.UITL package, you can actively adjust the size of the array.
The GetClass method in the 21.class class object class returns an instance of the Ckass type, and the class that is included in the main method when the program starts is loaded, the virtual machines load all the classes that he needs, and each loaded class loads the classes it needs.
The 22.class class provides powerful functional reflection for writing programs that dynamically manipulate Java code, a feature that is particularly useful for JavaBeans, and uses reflective Java to support the tools that VB programs Ape used to. A program that can parse the class's capabilities is called a reflector, and the package called Java.lang.reflect, which provides this functionality in Java, is a powerful reflection mechanism.
The ability to parse the class at execution time.
An object that explores the class at execution time.
Implements a generic array manipulation code.
Provides a method object. And this mechanism is mainly for the tool and not the application and the program. The most important part of the reflection mechanism is agreeing to examine the structure of the class. The API used is: Java.lang.reflect.Field returns the field. Java.reflect.Method returns the method. Java.lang.reflect.Constructor returns the number of references. Method Pointers: Java does not have a method pointer, the address of a method is passed to another method, can be called later, and the interface is a better way to resolve.
23. The interface (Interface) describes what the class should do without specifying what to do, and a class can implement one or more Interface.
24. An interface is not a class, but a set of specifications for a class that conforms to the interface requirements. To implement an interface requires 2 steps: 1. Declare the specified interface that the class is required to implement. 2. Provide a definition of all the methods in the interface. Declaring a class to implement an interface requires using the Implements Keyword Class ACTIONB implements comparable its actionb need to provide a CompareTo method, the interface is not a class, you cannot instantiate an interface with new.
25. A class has only one superclass, but a class can implement multiple interfaces. An important interface in Java: cloneable
26. Interfaces and callbacks. Programming a frequently used pattern is the callback pattern, in which you can specify the method on the callback object when a particular time occurs. Example: ActionListener interface monitoring. Similar APIs are: Java.swing.JOptionPane java.swing.Timer java.awt.Tookit
27. The object Clone:clone method is an object-protected method, which means that your code cannot simply call it.
28. Inner class: The definition of an inner class is defined in a class that also has an inner one. The reasons are:
An object of an inner class can access the implementation of the object that created it, including private data.
For other classes in the same package, the inner class can be hidden.
Anonymous inner classes can be very convenient for defining callbacks.
It is easy to write event drivers using an internal class.
29. Proxy: 1. Specify all the methods that the interface requires all code 2.object classes define (ToString equals)
30. Data type: Java is the language of the emphasis type, each variable must first declare that it is a type, Java has a total of 8 basic types. 4 types are integer, 2 are floating-point type, one is character type, it is used in Unicode encoding characters, Boolean type.
30 Basic concepts for beginners in Java