Chapter 1 Java programming overview, Chapter 2 java programming
1.1 Java programming platform
- Java is not just a language. Java is a complete platform:
1.2 key terms of Java "White Paper" 1. Simplicity
- Java syntax is a pure version of C ++ syntax.
2. Object-oriented
- Object-oriented is a programming technique that focuses on data (object) and object interfaces.
3. Network skills
- Java has an extended routine library for processing TCP/IP protocols such as HTTP and FTP.
- Java applications can open and access objects on the network through URLs, which is as convenient as accessing local folders.
- Java makes it so easy to open a Socket connection.
- The remote method call mechanism allows communication between distributed objects.
4. robustness (reliability)
- The Java compiler can detect many problems that can only be detected at runtime in other languages.
- The biggest difference between Java and C ++ is that the pointer model used by Java can eliminate the possibility of overwriting memory and data corruption.
Language |
Type |
Description |
C |
Languages with display pointers |
You need to use pointers to access strings, arrays, objects, and even files. |
VB |
No show pointer Language |
You do not need to use pointers to access these entities, or worry about memory allocation issues. However, a language without pointers is difficult to implement many data structures. |
Java |
Advantages of both parties |
No pointer is required to construct structures such as strings and arrays. But if necessary, it can also have pointer capabilities, such as linked lists. Java is absolutely safe and never accesses a "bad" pointer, causing memory allocation errors and preventing Memory leakage (garbage collection mechanism ). |
5. Security
- Java is applicable to network/distributed environments. Java can be used to build anti-virus and tamper-proofing systems
6. Neutral Architecture
- The compiler generates an architecture-neutral target file format (bytecode), which is just a compiled code, as long as there is a Java runtime system (JRE ), it can run on many processors. The well-designed bytecode not only can be easily interpreted and executed on any machine, but also can quickly translate the code of the local machine.
- Of course, the interpretation of bytecode will certainly be much slower than running machine commands at full speed.
- Instant Compilation: the virtual machine has an option to translate the most frequently used bytecode into machine code.
7. Portability
- The Java specification does not depend on specific implementations. The size of the basic data type and Related algorithms are clearly described. For example, in Java, int is always a 32-bit integer.
- The data type has a fixed size. binary data is stored and transmitted in a fixed format. strings are stored in a standard Unicode format.
8. Explanatory
- The Java interpreter can execute Java bytecode on any machine with the interpreter transplanted.
9. High Performance
- Bytecode can be quickly translated into a specific CPU machine code that runs the application at runtime.
10. Multithreading
- Multithreading can bring better interaction response and real-time behavior.
- As long as the operating system supports it, threads in Java can use multiple processors.
- At the underlying layer, the thread implementation mechanisms of mainstream platforms are different, and Java is not unrelated to this platform. on different platforms, the code that calls multiple threads is identical; java handed over the implementation of multithreading to the underlying operating system or thread library.
11. Dynamic
- It is very easy to find the runtime type information in Java
1.3 Java applet and Internet
- Java has become the most popular language for developing server-side applications. Using these server-side applications can generate Web pages and run backend logic.
1.4 Java Development History 1.5 common misunderstandings about Java