In our usual development I want to use the most language is Java, was fortunate to buy the Java Core Technology volume a book, actually do not want to purchase, because they feel the foundation is also good, have read crazy Java handouts, Java programming ideas of these foundations, but also read Java network programming, Spring core technology volumes such as advanced books. And this book is destined, a study sister turn test, cheap resale, see her so hard, I really do not have the heart to buy this book. Prepare to Midnight Oil tonight, and leave the evening to the book. Open the first volume of the book, Very good to me to illustrate the Java 11 advantages.
1. Simplicity:
This simple in my opinion is simple and not simple, how to say, how to take it and C, compiled to contrast, really is a lot simpler, we see Java inside no header file, pointer operation (even the pointer syntax, but I think the Java reference is similar to the pointer), structure, union, operator overload, virtual base class. However, the designers did not try to clear all the inappropriate features in C + +, such as switch, but the Java if statement is really powerful, we can use if, else to make all the judgments of true and false. In addition Java's class library is very powerful, we can use Java to do most of the programming, which makes programming easier;
2. Object oriented:
I have been talking about object-oriented, including the first chapter of my study of Java, the teacher told me what is object-oriented, at that time to listen to the foggy, only remember everything is object. Object-oriented simplicity is a programming technique. It focuses on the data (that is, the object) and the interface of the object. People eat to give an example, object-oriented will be so expressed, the person (eat) rice, where people and rice is the object, and eat we can understand become action. The person is the subject and the rice is the object, eat is the so-called predicate. And our focus is on what the process is about, and the focus is on eating the process. The first meaning to be expressed is to eat, and then to eat to guide it. What to eat, answer Yue eat. He who eats, eats. I originally faced the process is like this AH.
In the past 40 years, Object-oriented has proved its own value, a modern programming language is not practical object-oriented technology is simply unbelievable. Indeed, Java's object-oriented features are equivalent to C + + drums. The main difference between Java and C + + is multiple inheritance, which is replaced by simple interface inheritance and Java element model in Java.
3. Network skills:
Java has an extended example threading that handles TCP/IP protocols such as HTTP and FTP. Java applications can open and Access objects on the network through a URL, and their convenience programs are like accessing local files.
It has been seen that Java's network is powerful and easy to use. Anyone who has ever tried to do network programming in other languages will exclaim that Java has become so simple as to turn on heavy tasks like opening socket connections. In addition, the remote method invocation mechanism makes communication between distributed objects possible.
4. Robustness:
One of Java's design goals is to make Java-written programs have many reliability. Java invested a lot of energy in the early detection of problems, late dynamic (run-time) detection, and eliminate the state of error prone ... The biggest difference between Java and C + + is that the pointer model used in Java eliminates the possibility of rewriting memory and bad data. This feature is very useful, when we write the program will often automatically prompt many other languages only at runtime to detect errors. As for the 2nd, it is even more useful, for those who have been calling for hours to stick to the memory conflicts caused by pointer bugs, must be very fond of the Java feature. The principle is that the Java memory model, he put the reference and the actual value in two different memory, this later to elaborate.
5. Security:
Java is suitable for network/distributed environments. In order to achieve this goal, a great effort has been devoted to security. Use Java to build antivirus, tamper-resistant systems.
6. Architecture Neutrality:
The compiler generates an architecture-neutral target file format, a compiled code that can run on many processors as long as there is a Java runtime system. This is not a new idea, more than 40 years ago this technology, of course, it is very slow to perform, but the virtual machine has a strategy is to use the most cumbersome bytecode sequence translated into machine code, this process is called Just-in-time compilation.
7. Portability:
Unlike C, there is no place in the Java specification that relies on concrete implementations. The size of the base data type and the algorithms are clearly described.
For example, the basic type of Java is always fixed, regardless of the circumstances, and in C, the int is likely to be 16 bits, and possibly 32 bits. Only the size of the data type and the relevant algorithms are fixed, we do not need to rewrite the code on any application system.
8. Interpretative Nature:
The Java interpreter can execute Java bytecode on any machine that has ported the interpreter, so I say Java is an interpretive language that is easier for people to understand and write on the syntax, because linking is an incremental and lightweight process. So the development process has become quicker and more exploratory.
9. High performance:
Although the performance of the interpreted bytecode is satisfactory, in some cases more efficient performance is required. Bytecode Karki (at run time) translates quickly into the machine code of a particular CPU running this application. In the early days of Java performance has been a piece of criticism, but now the speed of Just-in-time compilation has been very fast, and the JVM has been a lot of optimizations, resulting in Java performance is faster now.
10. Multithreading:
Multithreading can lead to better interactive response and real-time behavior. At the same time also greatly improve the efficiency of our implementation, here multithreading this double-edged sword is not much to say, Java for us to achieve multithreading provides a lot of support, so that we can more easily to write multithreaded programs. At the bottom, the mainstream platform to implement multithreading mechanism are different.
11. Dynamic Nature:
From a variety of perspectives, Java is more dynamic than C, it can adapt to the evolving environment, the library can be free to add new methods and instance variables without any impact on the client. The main reason here is that Java is using interface inheritance. Not to destroy our original methods, so as to achieve new functions. Dynamic is a very important feature when we need to add some code to a running program, because we can get the Run-time class information, which is very useful for the Javagui builder, only for debugger, pluggable components, and object databases.