If you are interested in the leaderboard for developing languages, you will find that Java has been the top-level development language for a long time, as a Java developer, proud of it and deeply worried, proud to be so powerful in its own contact with the development language, The worry is, in case one day the Java market share no longer, then where do we go? But this is not the case, before the fall of Java we should first understand the Java, and then in-depth understanding of the computer world, for the Java programming language, we mainly through several aspects to learn: The history of language, the basic composition of language, object-oriented, strings and numbers, common tool classes, collections, IO, multithreading and so on.
Today's study mainly introduces the Java programming language Overview, the content explains how Java is produced, what are the advantages. The following begins today's study;
Preface
Java is an object-oriented programming language, not only absorbs the various advantages of the C + + language, but also rejects the difficult to understand C + + inheritance, pointers and other concepts, so the Java language has a powerful and easy to use two features. As the representative of static object-oriented programming language, the Java language implements the object-oriented theory, which allows programmers to do complex programming in an elegant way.
Java has the features of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, and dynamic. Java can write desktop applications, Web applications, distributed systems, and embedded system applications.
above is the Baidu Encyclopedia for Java Interpretation, have developed experience of people is very good understanding, but for some initial development process originally said, may not be able to understand the meaning behind each word, the following we come from the Java production of speaking;1.1 Java Introduction
Java is an advanced object-oriented programming language. Programs written in the Java language are cross-platform, from PCs to handheld computers with Java-developed programs and games, and Java programs can run on any computer, operating system, and Java-enabled hardware device.
1.1.1 History of the Java language
In the the 1990s, a single-chip computer system appeared in the hardware field, which immediately aroused the attention of the people in the field of automatic control, because it could greatly improve consumer electronic products ( such as TV set-top boxes, bread ovens, mobile phones, etc. ). the level of intelligence. In order to seize the market opportunity, sun Company set up a project team called Green in 1991, Patrick, James Goslin, Mike Chelindan, working with several other engineers, studied and developed new technologies in a small studio on Dune Road in California State, Menlo Park, specializing in embedded applications of computers in home appliance products.
the C + + program is too complex and bulky for monolithic systems with extremely scarce hardware resources. In addition, because of the variety of embedded processor chips used in consumer electronics, how to make the program run across platforms is a challenge. In order to solve the difficulties, they first focus on the development of language, it is assumed that a simple structure, in line with the needs of the embedded application of the hardware platform architecture and developed a corresponding specification, which defines the hardware platform of the binary Machine code instruction system (which later become "bytecode" command system), in order to develop the language successfully , can have semiconductor chip manufacturers to develop and produce this hardware platform (which is actually the origin of Java cross-platform design) . for the new language design, Sun's developers did not develop a new language, but based on the requirements of embedded software, C + + has been modified to remove some of the C + + 's less practical and impact security components, and combined with the real-time requirements of embedded systems, Developed an object-oriented language called Oak . (Oak is the predecessor of the Java language), a name derived from an oak tree outside the James Gosling office window.
since the development of the oak language, there is no hardware platform to run bytecode, so in order to develop the language can be experimental research, they are on
the basis of existing hardware and software platform, according to their own specifications, with the software to build a running platform ( This is actually the real concept of the JVM, it is just a virtual implementation of the hardware environment of the software running, but the whole system is more simple than C + +, there is no big difference. In the summer of 1992, when the Oak language was successfully developed, the researchers demonstrated to hardware manufacturers the green operating system, Oak's programming language, class library, and its hardware to persuade them to use the oak language to produce hardware chips, but the hardware makers did not have a great deal of enthusiasm. Because they believe that the risk of producing hardware products is too high for everyone to know about the oak language, and that the oak language is not able to enter the market because of lack of hardware support, and is shelved. in July 1994, after a three-day discussion, the team decided to change the goal again, and this time they decided to apply the technology to the World Wide Web. They believe that with the advent of mosaic browsers, the Internet is evolving to the same highly interactive vision that they see in the cable network. As a prototype, Patrick Norton wrote a small web browser webrunner. In the 1995, the boom in the internet gave oak opportunity. Industry in order to make rigid, monotonous static web pages can be "flexible", the need for a software technology to develop a program, which can be spread through the network and can be
run across platforms . Therefore, the world's major IT companies have invested a lot of manpower, material and financial resources. At this time, Sun recalled the long-shelved oak, and re-examined the software-written test platform, because it was written according to the embedded system hardware platform architecture, so very small, especially for the network transmission system, and oak is a concise language, The program is very small and suitable for transmission over the network. Sun first introduced an applet that could be embedded in a Web page that can be transmitted over the Web
(an applet is a technique for embedding applets in a Web page)and renamed Oak to Java
(when applying for a registered trademark, found that oak had already been used, after a series of names, and finally, using Java words that the proponents had no intention to mention when drinking a cup of Java coffee. At Sun World May 23, Sun unveiled its official Java and HotJava browser. Major companies such as IBM, Apple, DEC, Adobe, HP, Oracle, Netscap
e , and Microsoft have halted their own development projects, competing to purchase Java licenses and developing the appropriate Java platform for their products. in January 1996, Sun released the first Java Development Kit
(JDK 1.0), an important milestone in Java's evolution, marking Java as a standalone development tool. In September, about 83,000 Web pages were created using Java technology. In October, Sun released the first
instant (JIT) compiler for the Java platform. JDK 1.1 was released in February 1997, reaching 220,000 downloads in the next 3 weeks. April 2, the Java one conference, attended by more than 10,000 people, creating a record of the world's similar conference size. In September, the Java Developer connection community was more than 100,000 members. December 8, 1998, the second generation of the Java Platform Enterprise version of the EE published. In June 1999, Sun released the 3 versions of the second-generation Java platform (JAVA2): J2ME (mini-version of the JAVA2 Micro EDITION,JAVA2 platform) for mobile, wireless, and limited resources; J2SE (Java 2 Standard Edition,java 2 platform), applied to desktop environments, and Java EE (Enterprise Edition of the Java 2Enterprise Edition,java 2 platform), is applied to an application server that is based on the cloud. The release of the Java 2 platform is one of the most important milestones in the Java development process, marking the beginning of the popularity of Java applications. (2 of what we used to see in books or other subcategories is from the Java1.2 version)April 27, 1999, hotspot virtual Machine released. The
hotspot virtual machine was released as an add-on to JDK 1.2, and later it became the default virtual machine for all versions of JDK 1.3 and later Sun JDK. in May 2000, JDK1.3, JDK1.4 and j2se1.3 were released in succession, and weeks later they were supported by Apple's industry standard for Mac OS x. September 24, 2001, j2ee1.3 released. February 26, 2002, j2se1.4 released. Since then, Java has had a significant increase in computing power, with nearly 62% more classes and interfaces than j2se1.3. Among these new features are a wide range of XML support, Secure Sockets
(socket) support
(via SSL and TLS Protocol), new I/O APIs, regular expressions, logs and assertions.
September 30, 2004, j2se1.5 released as another milestone in the development of the Java language. To indicate the importance of this version, J2SE 1.5 was renamed Java SE 5.0
(build number 1.5.0), codenamed "Tiger", Tiger
Contains the most significant updates since the release of version 1.0 in 1996, including generic support, automatic boxing of basic types, improved looping, enumeration types, formatted I/O, and mutable parameters. in June 2005, at the Java One conference, Sun released the Java SE 6. At this point, various versions of Java have been renamed, and the number 2 has been canceled, as the JAVAEE,J2SE renamed Javase,j2me renamed to Javame. November 13, 2006, the inventor of Java technology, Sun, announced the release of Java technology as free software. The first source code for the Standard edition of the Java platform, as well as the executable source code for the Java Mini Edition, is officially released by Sun. Since March 2007, all developers around the world have been able to modify the Java source code. Oracle announced its acquisition of Sun in 2009. In 2010, James Goslin, one of the co-founders of the Java programming language, resigned from Oracle Corporation. In 2011, Oracle held a global event to celebrate the launch of Java7, which was followed by Java7 's official release. In 2014, Oracle released the JAVA8 version of the company. 1.1.2 What is the Java language
Java was a creative, object-oriented programming language introduced by Sun in 1995 and was designed by Dr. James Goslin, a Fellow of the father of Java, to complete the original compilers and virtual machines of Java technology. Java's original name was Oak, which was renamed to Java in 1995 and is officially released.
Java is a language that is executed in an interpreted manner , with syntax rules similar to C + +. At the same time, Java is also a cross-platform programming language. Programs written in the Java language can be run on any platform and device, such as spanning IBM PCs, Mac Apple computers, various microprocessor hardware platforms, and systems platforms such as Windows, UNIX, OS/2, MAC OS, to truly " write once, run everywhere ". Java is ideal for enterprise networks and Internet environments, and has become one of the most influential and popular programming languages in the Internet.
Compared with the current common C + +, the Java language is much simpler and more reliable, removing the biggest source of program errors, and he has a high level of security, arguably the most remarkable programming language in history.
Programs written in the Java language are both compiled and interpreted . The process sequence code is compiled and converted into an intermediate language called Java bytecode, and the Java Virtual Machine (JVM) interprets and runs the bytecode. Compilation occurs only once, and interpretation occurs every time the program is run. The compiled bytecode is saved as a machine code optimized for the JVM, the virtual machine interprets the bytecode as a machine code, and then runs on the computer. the Java Language Program code is compiled and run as shown in procedure 1.1.
Figure 1.1 Compiling and running the Java program
1.1.3 Java application Areas
With Java, program developers have the freedom to use existing hardware and software system platforms. This is because Java is platform-independent and can be applied to areas outside the computer, where Java programs can run on laptops, televisions, telephones, mobile phones, and other large numbers of electronic devices. There are countless uses for Java, and he has unparalleled ability to save time and money. The main areas of application of Java are as follows:
- Desktop application system development.
- Embedded system development.
- E-commerce applications.
- Enterprise-class application development.
- Interactive system development.
- Multimedia system development.
- Distributed system development.
- Development of Web application systems.
Java is ubiquitous, it already has millions of users, and it is growing faster than any computer language before it. Java can bring countless benefits to businesses and end users. Larru Ellison, chairman and CEO of Oracle, said: "Java is entering businesses, homes, and schools." It is becoming a ubiquitous technology like the internet itself. ”
If you look closely, you will find that Java is around us, such as the Java development tools we use frequently, Eclipse, NetBeans, JBuilder, and so on, plus rssowl, Limewire, Azureus, Cyberduck, Good software such as OpenOffice is written in Java. In addition, the handset manufacturers to their products to provide Java technology Support, a variety of mobile phone Java programs and games have been countless.
1.1.4 version of Java
Since Sun introduced Java, it has tried to make it omnipotent. Java development so far, according to the scope of application is divided into three versions, namely Java SE, Java EE, Java ME, that is, Java one (Open Net environment) system. This section describes each of the 3 Java versions.
1.Java SE
Java SE is the standard version of Java, mainly used for desktop application development, but also the basis of Java, it contains the Java Language Foundation, JDBC (Java Database Connectivity Operations), I/O (input and output), network communication, multithreading and other technologies. The Java SE structure is shown in 1.2.
Figure 1.2 Structure of Java SE
2.Java EE
Java EE is the Enterprise edition of Java and is mainly used to develop enterprise-level distributed network programs, such as e-commerce sites and ERP (Enterprise resource Planning) systems, with the core of EJB (Enterprise Java component model). The Java EE structure is shown in 1.3.
Figure 1.3 Structure of Java EE
3.Java ME
Java me is mainly used in embedded system development, such as handheld computers, mobile phones and other mobile communications electronic devices, most mobile phone manufacturers now produce mobile phones are supported by Java technology. The structure of Java me is shown in Figure 1.4.
Figure 1.4 Structure of Java me
1.1.5 How to learn Java
How to learn the Java language, is all beginners need to face the problem, in fact, each language learning methods are the same, beginners need to pay attention to the main points are as follows:
- Clear their learning goals and big direction, choose and lock a language, according to their own learning direction to study hard, seriously study.
- Beginners do not read too many books, the first to find the basis of the book System of Learning. Many program developers work for a long time and are only familiar with the basics, and do not learn the Java language in a systematic way.
- Learn about design patterns. The development program must write program code that must be highly readable so that the program written can be debugged, maintained, and upgraded in value. Learn some design patterns to better grasp the overall structure of the project.
- Don't rote grammar. When you first touch a language, especially the Java language, master the basic syntax and probably understand some of the features. With code-assist capabilities for development tools such as Eclipse or NetBeans, code entry is done so that you can quickly get to the learning state.
- More practice, more thinking, more advice. Reading only the content and technology in the book is not possible, you must write the program code, and run the program, analyze the running structure, so that the learning content has a whole understanding and affirmation. Think in your own way, write code to improve your programming ideas. Often ask the teacher or manager, and other people to communicate technical problems, improve their skills and insight.
- Don't be impatient. In the face of technical problems, we must calm down, do not let their thinking confusion, keep a clear mind to analyze and solve various problems. You can try to relax yourself with songs and walks.
- Encounter problems, first try to solve their own, so that you can improve their program debugging ability, and have a certain understanding of common problems, understand the cause of the error, or even extrapolate, solve other related error problems.
- Read more information. Can often go to the Internet to search for relevant information or solve the problem of the method, the network has extracted a lot of people have encountered problems and different solutions, analysis of these problem-solving methods to find the most suitable for their own method.
- Read more about other people's source code. Not only to understand other people's program code, but also to analyze the programmer's programming ideas and design patterns, and integration for their own use.
1.1.6 Java API documentation
The full name of the API is application programming Interface, the application programming interface. Java API documentation is an indispensable programming dictionary for Java Program development, and records a large amount of APIs in the Java language, including the inheritance structure of classes, member variables and member methods, construction methods, detailed descriptions of static members, and descriptive information. The latest version of the JDK document (i.e. the API documentation) can be found in the Java Web site http://java.sun.com, as shown in page effect 1.5 of the Java API documentation.
Figure 1.5 Java API Documentation page
1.1.7 Java language composition
Java is made up of four aspects:
The Java programming language, or syntax.
Java file format, which is the suffix of various folders and files.
The Java Virtual machine (JVM), the interpreter that processes the *.class file.
Java Application Interface (Java API).
1.2 Features of the Java language
The authors of the Java language have written a broad-based Java white Paper with a detailed description of their design goals and achievements, as well as a brief description of the Java language features. These features are briefly described below.
1.2.1 Simple
The Java language syntax is straightforward, easy to master, and is a purely object-oriented language. The simplicity of the Java language is mainly reflected in the following aspects:
- The syntax rules are similar to C + +. In a sense, the Java language has evolved from the C and C + + languages, so C program designers can easily master the syntax of the Java language.
- The Java language simplifies and improves C + +. For example, Java uses interfaces instead of multiple inheritance and cancels pointers because pointers and multiple inheritance often complicate the program. The Java language also simplifies the resource release management of programmers by implementing garbage collection automatically.
- Java provides a rich library of class libraries and API documentation and third-party development packages, plus a large number of Java-based open source projects, the JDK (Java Developer Toolkit) has been opened up, the reader can analyze the source code of the project, so as to improve their programming level.
1.2.2 Object-oriented
Object-oriented is the foundation of the Java language and is also an important feature of the Java language, which is itself a purely object-oriented programming language. Java advocates that all things are objects, grammar cannot define separate data and functions outside the class, that is, the outermost data type of the Java language is an object, and all elements are accessed through classes and objects.
Object-oriented is also a process-oriented understanding: Object-oriented is relative to the process, the process is focused on the implementation of the function, while object-oriented is to encapsulate the implementation of the same function into an object, and then call this object to focus on the function, focus on the ability to implement the function of the object.
Distribution of 1.2.3
The distribution of Java includes operation distribution and data distribution, in which the operation distribution refers to the arrangement of related operations on several different hosts, and the data distribution is to store the data on several different hosts, which are different members of the network. Java can access network objects with a URL (Uniform Resource Locator) object, in the same way as accessing the local system.
1.2.4 Portability
Java programs have architecture-independent features that can be easily ported to different computers on the network. At the same time, the Java class Library also implements the interface for different platforms, so that these libraries can be ported.
1.2.5 Explanatory type
The interpreter is required to run the Java program. Any computer or other device that has a Java interpreter ported can be interpreted with Java bytecode. Bytecode is independent of the platform, which itself carries many compile-time information, making the connection process more simple, the development process more rapid, more exploratory.
1.2.6 Security
The Java language removes syntax such as pointers in C and memory release, effectively avoiding the illegal operation of memory. Java program code to go through code validation, pointer validation and many other test steps to run, so the Java program is not allowed to harm the system platform behavior, and Java can write anti-virus and anti-modification system.
1.2.7 Robustness
One of the design goals of Java programs is to write multi-faceted, reliable applications that Java will check for errors at compile and run time and eliminate errors. Type checking can help users check out many of the errors that occurred early in development. The advent of integrated development tools, such as Eclipse, NetBeans, also makes it easier to compile and run Java programs.
1.2.8 Multi-Threading
Multithreaded mechanisms enable applications to perform multiple tasks in parallel at the same time, and the corresponding synchronization mechanism ensures that different threads can share data correctly. The use of multi-threading can lead to better interactivity and real-time behavior.
1.2.9 High Performance
Java compiled bytecode is run in the interpreter, so it's faster than most interactive "interaction means you and the program dialog." For example, you click a button, and then the program pops up a window "Do you really want to quit?" So you can choose. This is called interaction. Most of the current programs are interactive programs. "The application has improved a lot. In addition, bytecode can be translated into the machine instructions of a specific platform when the program is run, thus further improving the speed of operation.
1.2.10 News
Java in many ways than C and C + + to adapt to the development of the environment, you can dynamically adjust the library methods and add variables, and the client does not need any changes. Dynamic tuning in Java is simple and straightforward.
1.2.11 Architecture Neutrality
Programs written by Java are compiled to generate bytecode. Not only can this bytecode be executed easily on any machine, but it can also be translated dynamically to local machine code. This is the embodiment of Java architecture neutrality, but it is still dependent on the JVM implementation.
J1. Java programming language Overview