Second, there is a tutorial that can teach you live broadcast no matter where you are.
Many tutorials circulating on the Internet are many years ago, which are far from meeting the needs of new Java applications. Basically, they are outdated goods. Many friends, looking for this kind of rubbish from the internet, are not only happy to learn, but also drunk. To sum up, many of us can't learn Java well because we made the wrong choice and our efforts were in vain. In order to enable the vast number of Java students to learn the essence of Java system knowledge on the Internet and understand it easily, we decided to broadcast live on the Internet every night to teach you to learn Java. Neither our teachers nor ordinary teachers need it. We only let Mr. Niu Biao talk, and you don't have to hand in anything. You just need to come to our group to listen. The first part at the beginning is: 426. The second part is: 396, and the last part is: 284. There is no excuse for studying. If you want to be strong, you must work hard. At the same time, this is not an era of going it alone. Let's study together here and strive to create our own new Java world.
Three basic concepts of Java beginners
In the process of learning java, whether it is J2SE, J2EE or J2ME, it is very important for us to master the basic concepts. J2SE is the foundation of Java, so it is necessary to summarize the basic concepts in order to better understand the essence of Java in the later learning process. Here I summarize 30 basic concepts.
Overview of Java:
At present, Java is mainly used for the development of middleware)-the communication technology between client and server. Early practice has proved that Java is not suitable for the development of pc applications, and its development has gradually turned to the development of handheld devices, Internet information stations and on-board computers. The difference between Java and other languages is that it provides platform independence when the program runs, and it can use exactly the same code in windows, Solaris, linux and other operating systems. The syntax of Java is similar to that of C++, which is easy for c++/C programmers to master, and Java is completely object-oriented, in which a good GC (garbage collector) garbage disposal mechanism is proposed to prevent memory overflow.
The Java white paper gives us the key features of 1 1 Java language.
(1) Easy: The syntax of Java is relatively simpler than that of C++. On the other hand, Java can make software run on very small machines. The basic explanation is that its size supported by class library is about 40kb, and the memory supported by basic standard library and thread needs to be increased by 125kb.
(2) Distributed: Java has a powerful routine library of TCP/IP protocol family, and Java applications can access remote objects through the network through URL. Due to the emergence of servlet mechanism, Java programming is very efficient, and now many large web servers support servlets.
(3)OO: Object-oriented design is a programming technology focusing on objects and object interfaces. Its object-oriented is different from C++ in that it is different from multiple inheritance processing and Java's original class model.
(4) Robustness: Java adopts the safe pointer model, which can reduce the possibility of rewriting memory and data crash.
(5) Security: Designing networks and distributed systems with Java brings new security problems. Java can be used to build anti-virus and anti-attack systems. As it turns out, Java has done an excellent job in anti-virus.
(6) Neutral architecture: Java compiles the target file format with a neutral generation architecture, which can be executed on many processors. The instruction bytecode generated by the compiler realizes this feature, which can be interpreted and executed on any machine.
(7) Portability: Java has strict regulations on the size and algorithm of basic data structure types, so it has good portability.
(8) Multithreading: The process of Java dealing with multithreading is very simple, and Java gives the implementation of multithreading to the underlying operating system or threaded program. So multithreading is one of the reasons why Java is popular as a server-side development language.
(9) Applets and servlet: Programs that can be executed on web pages are called applets. Many browsers need to support Java, while applets support dynamic web pages, which many other languages cannot do.
Basic concepts:
At 1. OOP, the only thing that matters is what the interface of the object is. Just like a computer manufacturer, regardless of the internal structure of the power supply, the only thing that matters is whether it can supply you with power, that is, as long as you know whether it can, not how and why. All programs are composed of objects with certain attributes and behaviors. Access to different objects is completed through function calls, while all communication between objects is through method calls and encapsulation of object data, which is very huge.
The most important idea in 2.2. OOP is a class, a template and a blueprint. An object is constructed from a class, that is, an instance of the class is created.
3. Encapsulation: the process of combining data and behavior in a package) and hiding data from the object users. The data in an object is called its instance field.
4. Getting a new class by extending a class is called inheritance, and all classes are extended from the object root superclass, which will be introduced below.
5. Three main characteristics of an object
Behavior-Explain what this object can do.
State-The reflection of the object when the method is applied.
Identity-a sign that distinguishes it from other similar behavior objects.
Each object has a unique identity, and these three factors interact.
6. The relationship between classes:
Use -a: dependency
Has-a: aggregation relation
Is-a: Inheritance-For example, Class A inherits Class B. At this time, Class A not only has methods of Class B, but also has its own methods.
7. Use the constructor to construct the object: It is recommended to use the constructor. Constructor is a special way to construct an object and initialize it.
For example, the constructor of a Data class is called data.
New data()- Constructs a new object and initializes the current time.
Data happy day = new data()- Assign an object to a variable happyday so that the object can be used multiple times. The variable to be declared here is different from the object variable. The value returned by new is a reference.
Features of constructors: Constructors can have 0, one or more parameters.
Constructor and class have the same name.
A class can have multiple constructors.
The constructor did not return a value.
Constructors are always used with the new operator.
8. Overloading: Overloading occurs when multiple methods have the same name but different parameters. The compiler must choose which method to call.
9.package)java allows one or more classes to be grouped together to form a group, called a package, to facilitate the organization of tasks. The standard java library is divided into many packages, such as java.lang java.util java, net, etc. , and the package is layered. All Java packages are in the Java and javax package hierarchy.
10. Inheritance idea: allow to create new classes on the basis of existing classes. When you inherit an existing class, you can reuse its methods and fields, and you can add new methods and fields to the new class.
1 1. extension class: the extension class fully reflects the inheritance relationship of IS-A, in the form of: class (subclass) extension (base class).
12. Polymorphism: In java, object variables are polymorphic, but multiple inheritance is not supported in java.
13. Dynamic binding: a mechanism for calling object methods.
(1) The compiler checks the type and method name declared by the object.
(2) The compiler checks the parameter types of the method call.
(3) Static binding: If the method type is priavte static final, the compiler will know exactly which method to call.
(4) When the program uses dynamic binding to call the method, then the virtual machine must call the method version that matches the actual type of the object pointed by X..
(5) Dynamic binding: This is a very important feature, which can make the program extensible without recompiling the existing code.
14.final class: In order to prevent others from deriving new classes from your class, this class is not extensible.
15. Dynamic call takes longer than static call.
16. abstract class: the class itself that specifies one or more abstract methods must be defined as abstract.
Example: public abstract string getdescription
17 per shift. Java is an extension of the Object class.
The Equal and toString methods in the 18.object class.
Equal is used to test whether one object is equal to another.
ToString returns a string representing an object, and almost every class overloads this method to return a correct representation of the current state.
(toString method is a very important method)
19. Universal programming: All values of any class type can be replaced by variables of the same class as object.
20.ArrayList: ArrayList dynamic array list is a class library, which is defined in the java.uitl package and can automatically adjust the size of the array.
The getclass method in the 2 1. class object returns an instance of type ckass. When the program starts, the classes contained in the main method will be loaded, and the virtual machine will load all the classes it needs, and each loaded class will load the classes it needs.
22.class provides a powerful function reflection for writing programs that can dynamically manipulate java code, which is especially useful for JavaBeans. Using reflective Java can support the tools that VB programmers are used to.
The program that can analyze class capabilities is called reflector, and the package that provides this function in Java is called Java.lang.reflect The reflection mechanism is very powerful.
1. The ability to analyze classes at runtime.
2. Browse the objects of the class at runtime.
3. Implement general array operation code.
4. Provide method objects.
Moreover, this mechanism is mainly aimed at tools rather than applications and programs.
The most important part of the reflection mechanism is to allow you to check the structure of the class. The APIs used are:
Java.lang.reflect.Field returns a field.
Java.reflect.Method returns the method.
Java.lang.reflect.Constructor returns parameters.
Method pointer: java has no method pointer. Pass the address of one method to another method, which can be called later. Interface is a better solution.
23. The interface describes what a class should do, but does not explain how to do it. A class can implement one or more interfaces.
24. An interface is not a class, but a set of specifications of a class that meets the interface requirements.
Implementing an interface requires two steps:
1. Declares the specified interface that this class needs to implement.
2. Provide definitions of all methods in the interface.
Declaring a class implementation interface requires the implements keyword.
Class actionb implements a comparable. Its Action B needs to provide a CompareTo method, and 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. A common programming mode is callback mode, in which you can specify a method on a callback object when it occurs at a specific time.
Example: ActionListener interface monitoring.
Similar APIs are: java.swing.JOptionPane
Java. swing.timer
java.awt.Tookit
27. Object cloning: The cloning method is an object protection method, which means that your code cannot simply call it.
28. Inner class: The definition of an inner class is a class defined inside another.