What is Java?
Java seems to be everywhere - even in TV. Despite this, it's not so easy to say what Java is and what it can do. s and what it can do is not so easy. People who are new to Java usually have three ?
Questions: ?
What is Java ?
What can Java do??
How can Java change my life??
Let's start by answering the first question: What is Java?
Java is both a programming language and a platform.?
Java programming language?
Java is a high-level programming language with the following characteristics:?
Simple?
Object-oriented?
Distributable?
Interpretable?
Strong?
Secure?
Structured?
Lightweight?
Powerful?
Multi-threaded?
Dynamic?
Java can be both compiled and interpreted. With a compiler, a Java?program can be translated into a kind of intermediate code - called bytecode - that can be interpreted by the Java interpreter?
Platform-independent code that is interpreted. With the interpreter, each Java byte instruction is ? analyzed and then run on a computer. It only needs to be compiled once, and the program runs when the interpreter? executes.
One There are a lot of tutorials, called Learning for nothing
These days, the online Java tutorials a bunch of a bunch of look at us a lot of Java babies are dazzled, do not know how to be good, I was also from the process over, every day to see a lot of teachers of Java tutorials to listen to their own dazed, of course, I'm not saying that they are talking about the wrong, they talk about the knowledge level of the I'm not saying that they are wrong, they talk about the knowledge level of things are right, but a lot of teachers do not do Java tutorials in-depth teacher, easy to understand to explain the knowledge for us, what is a good tutorial? Good tutorial is to let us learn, there is a feeling of clarity, rather than the clouds deep do not know the place, I want to say that this tutorial, do not look at it, a waste of time, confused about their own.
Two There is a tutorial called no matter where you are, can teach you live
Now many online tutorials are circulating many years ago, far from adapting to the needs of the new applications of Java, basically some of the elimination of the goods, a lot of partners, from the Internet to look for this kind of crap, learning is also not happy, is also drunk. To summarize, many of us can not learn Java, because the beginning of the wrong choice, the choice is not right, efforts in vain. In order to enable the majority of Java students to learn Java online system essence of knowledge, easy to understand this knowledge, we decided to now every night live online to teach you to learn Java, our teachers, general teachers do not have to, we only let the bullish teacher to speak, and you do not need to pay for anything, you just need to come to us to listen to this group on the line, the beginning of the first part is : 426., is located in the middle of the second part is: 396, in the last part is: 284, learning without any excuses, want to be strong have to work hard, and at the same time this is not a solo era, we are here to learn a piece, to fight belong to our new world of Java.
Three Java novice 30 basic concepts
In the process of our study of Java, to master the basic concepts of which our learning whether J2SE, J2EE, J2ME is very important, J2SE is the basis of Java, so it is necessary to do the basic concepts of which to summarize, so that we can better understand the essence of java in the process of future learning. the essence of understanding java, here I summarize the 30 basic concepts.
Java Overview:?
Currently, Java is mainly used in the development of middleware (middleware) - - dealing with the communication technology between the client and the server, early practice has proved that Java is not suitable for the development of pc applications, the development of its development has gradually become in the development of hand-held devices, the Internet information station, and the development of the car computer. Java is different from other languages in that it provides platform independence when the program runs, allowing you to use the exact same code on windows, solaris, linux and other operating systems. Java's syntax is similar to that of C++, which is easy for C++/C programmers to master, and Java is completely and thoroughly object oriented, and it proposes a very good Garbage Collector (GC) garbage collection system, which can be used to collect garbage from a computer. Garbage Collector) garbage disposal mechanism to prevent memory overflow.
Java's white paper presents us with 11 key attributes of the Java language.
(1) Easy: Java's syntax is relatively simple compared to C++'s. Another aspect of Java is that it enables software to run on very small machines, the size of the basic interpretation and class library support is about 40 kilobytes (kb), and adding the basic standard libraries and threading support requires an additional 125 kb of memory.
(2) distributed : Java with a very powerful TCP/IP protocol family of routines library , Java applications can be accessed through the URL to the network to access remote objects , due to the emergence of the servlet mechanism , so that the Java programming is very efficient , many of the large web server now support servlet .
(3) OO: object-oriented design is to focus on objects and object interfaces on a programming technique. Its object-oriented and C + + has many differences, in dealing with multiple inheritance and Java's original class model .
(4) Robustness: Java adopts a safe pointer model that reduces the possibility of memory rewrites and data crashes.
(5) security: Java is used to design networks and distributed systems , which brings new security issues , Java can be used to build anti-virus and anti-attack System. it has been proved that Java in the anti-virus this aspect of doing very good.
(6) neutral architecture: Java compiler to generate architecture-neutral target file format can be executed on many processors, the compiler generates instruction byte code (Javabytecode) to achieve this feature, this byte code can be interpreted and executed on any machine .
(7) portability: Java on the basic data structure type size and algorithms have strict rules so that the portability is very good.?
(8) multi-threaded: Java processing multi-threaded process is very simple, Java multi-threaded implementation to the operating system underneath or threaded program to complete. So multithreading is one of the reasons for the popularity of Java as a server-side development language.?
(9) Applet and servlet: the program can be executed on the Web page is called Applet, the need to support Java's browser a lot of, and applet support dynamic Web pages, which is many other languages can not do.?
Basic concepts:?
1. OOP is the only relationship between the object of the interface is what, like a computer salesman she does not care about the internal structure of the power supply is how, he only relations can provide you with electricity on the line, that is, as long as you know the can or not rather than how and why. all the program is composed of certain attributes and behavior of the object, the different object access through function calls to complete, all the objects between the object is composed of certain properties and behaviors. All programs are composed of objects with certain properties and behaviors, and access to different objects is accomplished through function calls, and all exchanges between objects are through method calls, which greatly improves the reuse rate by encapsulating object data.
2. OOP in the most important idea is the class, the class is a template is a blueprint, from the class to construct an object, that is, to create an instance of the class (instance).
3. Encapsulation: is the combination of data and behavior in a package) and the object user to hide the data implementation process, an object in the data called his instance field (instance field).
4. By extending a class to obtain a new class is called inheritance (inheritance), and all classes are extended by the root superclass of Object, the root superclass will be described below.?
5. 3 main characteristics of an object
behavior --- describes what the object can do.?
state----the reflection of the object when the object applies a method...?
identity --- a distinguishing mark from other objects of similar behavior.?
Each object has a unique indentity and these 3 interact with each other.?
6. Relationships between classes:?
use-a :dependency?
has-a :aggregation relationship?
is-a :Inheritance - Example: Class A inherits from class B. At this point, class A has not only the methods of class B, but also its own methods. (Individuality exists in ****ness)?
7. Constructing objects using constructors: constructors are proposed, constructors are a special method of constructing an object and initializing it.?
Example:The constructor of the Data class is called 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 multiple times, where the variable to be declared is not the same as the object variable. the value returned by new is a reference.?
Constructor features: constructors can have zero, one or more parameters?
Constructors and classes have the same name?
A class can have more than one constructor?
Constructors have no return value?
Constructors are always used with the new operator.?
8. Overloading: Overloading occurs when more than one method has the same name but different arguments. The compiler must pick which method to call.?
9. package (package) Java allows one or more classes to be collected together into a group, called a package, in order to facilitate the task of organizing the standard Java library is divided into a number of packages. java.lang java.util java, net, etc., the package is hierarchical all the java packages are in the java and javax packages within the hierarchy.?
10.Inheritance idea: allows to build new classes on the basis of already existing classes.When you inherit from an already existing class then you reuse the methods and fields of that class and at the same time you can add new methods and fields in the new class.?
11. Extension classes: extension classes fully reflect the is-a inheritance relationship. The form is:class (subclass) extends (base class).?
12. polymorphism: in java, object variables are polymorphic. And multiple inheritance is not supported in java.?
13.Dynamic binding:Mechanism for calling object methods.?
(1) Compiler checks the type and method name of the object declaration.?
(2) The compiler checks the type of parameters 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 a program is running and a dynamic binding is used to call a method, then the VM must call the version of the method that matches the actual type of the object pointed to by x.?
(5) Dynamic binding: an important feature that allows a program to become extensible without recompiling existing code.?
14. final class: to prevent others from deriving a new class from your class, this class is not extensible.
15.Dynamic calls take longer than static calls.?
16.Abstract class:A class that specifies one or more abstract methods must itself be defined as abstract.?
Example: public abstract string getDescripition?
17.Every class in Java extends 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.?
toString returns a string representing the object, and almost every class overrides this method to return the correct representation of the current state.?
(The toString method is a very important method)?
19. Generic Programming: All values of any class type can be replaced by variables of the same object type.
20. array list : ArrayList dynamic array list , is a class library , defined in the java.uitl package , you can automatically adjust the size of the array.?
21. class class object class getclass method returns an instance of the type ckass, program startup included in the main method of the class will be loaded, the virtual machine to load all the classes he needs, each loaded class to load it needs the class.?
22. class class for writing programs that can dynamically manipulate java code provides a powerful feature reflection , this feature is particularly useful for JavaBeans , using reflection Java can support VB programmers are accustomed to using the tools.?
The ability to analyze the ability of the program called reflector , Java provides this feature in the package called Java.lang.reflect reflection mechanism is very powerful ...?
1. The ability to analyze classes at runtime.?
2. The ability to probe the objects of a class at runtime.?
3. Implementation of generic array manipulation code.?
4. provide method objects.?
And this mechanism is primarily aimed at toolers rather than applications and programs.?
The most important part of the reflection mechanism is that it allows you to examine the structure of the class. The APIs used are: ?
java.lang.reflect.Field returns a field.?
java.lang.reflect.
java.lang.reflect.Constructor Returns the parameter ...?
Method pointer:java does not have a method pointer.Passing the address of a method to another method allows you to call it later.and interfaces are a better solution.
Method pointer:java does not have a method pointer.Passing the address of a method to another method allows you to call it later.and interfaces are a better solution.?
23. Interface (Interface) describes what the class should do without specifying how to do it, a class can implement one or more interfaces.?
24. An interface is not a class, but a set of specifications for a class that meets the requirements of an interface.
If you implement an interface, it takes 2 steps:?
1. Declare the specified interface that the class needs to implement.?
2. Provide definitions of all the methods in the interface.?
Declaring that a class implements an interface requires the completions keyword?
class actionB implements Comparable whose actionb needs to provide the CompareTo method, interfaces are not classes, you can't 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 pattern in programming is the callback pattern, in which you can specify a method on an object to be called back when a particular time occurs.?
Example: The ActionListener interface listens for...?
Similar APIs are: java.swing.JOptionPane?
java.swing.Timer?
java.awt.Tookit?
27. object clone: The clone method is a protected method of object, which means that your code cannot simply call it. code can't simply call it.?
28. internal class: an internal class is defined within another internal class.?
Why:?
1.An object of an inner class can access the implementation of the object that created it, including private data.?
2. An inner class can be hidden from other classes in the same package.?
3. Anonymous inner classes make it easy to define callbacks.?
4. Using inner classes makes it very easy to write event drivers.?
29. proxy class (proxy):?
1. The specified interface requires all code?
2. object class defined all the methods (toString equals)?
30. data types: Java is a language that emphasizes types , each variable must first declare it all types , java has a total of *** there are eight basic types . four are integer , two are floating-point , one is a character type , is used for Unicode encoding of characters , Boolean .