Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform-independence and portability, multi-threading, dynamics, etc. [2]. Java can write desktop applications, Web applications, distributed systems and embedded systems applications, etc. [3].
Foreign name
Java
Current company
Oracle
Launched
May 1995
Fast
Navigation
Programming development
Language features
Working principles
Language Fundamentals
Language Standards
Language Specifications
Technical Applications
Learning Guide
Language Evaluation
Development
In the 1990's, monolithic computer systems appeared in the hardware arena, and the appearance of such inexpensive systems immediately attracted the attention of those in the field of automation. Because the use of it can dramatically improve the degree of intelligence of consumer electronics (such as TV set-top boxes, bread ovens, cell phones, etc.). sun in order to seize the market first, in 1991, set up a project team called Green, Patrick, James Gosling, Mike Sherindan and several other engineers together with a working group composed of the work group in California, California Inside a small studio on Dune Road in Menlo Park, the group researched and developed new technologies, specializing in embedded applications of computers in home appliances.
JAVA
Researchers in the project group first considered writing programs in C++ because of its advantages. However, C++ programs are too complex and bulky for monolithic systems where hardware resources are extremely scarce. In addition, due to the variety of embedded processor chips used in consumer electronics products, it is also a challenge to make the program run across platforms. In order to solve the difficulties, they first focused on the development of the language, assumed a simple structure, in line with the needs of embedded applications of the hardware platform architecture and formulated the corresponding specification, which defines the hardware platform of the binary machine code instruction system (that is, later became the "byte code" of the instruction system), in order to wait for language development. When the language was developed, semiconductor chip manufacturers could develop and produce the hardware platform. For the design of the new language, Sun R & D staff did not develop a new language, but according to the requirements of embedded software, C + + + was transformed, in addition to stay in C + + + some of the less practical and affect the safety of the components, and combined with the real-time requirements of embedded systems, the development of a real-time requirements, object-oriented language called Oak.
Because at the time of the development of the Oak language, there was no hardware platform to run the byte code, so in order to develop this language can be experimental research, they on the basis of the existing hardware and software platform, according to their own specified specifications, with the software to build a platform to run the whole system in addition to the more simple than the C + + +, there is no major difference. 1992 In the summer of 1992, when the Oak language was successfully developed, the researchers demonstrated the Green operating system, Oak's programming language, class libraries, and its hardware to hardware manufacturers in order to persuade them to use the Oak language in the production of hardware chips, but the hardware manufacturers did not feel very enthusiastic about it. Because they thought it would be too risky to produce hardware products when no one knew anything about the Oak language, the Oak language was shelved due to the lack of hardware support and the inability to enter the market.
In June or July 1994, after a discussion that lasted three days, the team decided to change the goal of their endeavor once again, this time to apply the technology to the World Wide Web. They believed that with the arrival of the Mosaic browser, the Internet was evolving toward the same highly interactive vision that they had seen in cable networks. As a prototype, Patrick Norton wrote WebRunner, a small World Wide Web browser.[4]
In 1995, the Internet boom gave Oak an opportunity. In order to make the rigid, monotonous static web pages can be "flexible", the industry is in urgent need of a software technology to develop a program, this program can be spread through the network and can run cross-platform. Therefore, the world's major IT companies have invested a lot of human, material and financial resources. At this time, Sun remembered the Oak was put aside for a long time, and re-examined the test platform written in software, because it is written in accordance with the hardware platform architecture of embedded systems, so it is very small, especially suitable for the transmission system on the network, and the Oak is also a streamlined language, the program is very small, suitable for transmission on the network. Applet which could be embedded in a web page and could be transmitted with the web page on the web (Applet is a technology that embeds a small program into a web page for execution), and renamed Oak to Java (when applying for a registered trademark, it was discovered that Oak had already been used, and after a series of names were thought of, in the end, the Java word was used, which was unintentionally mentioned by the proponent while having a cup of Java coffee). On May 23, Sun officially released Java and the HotJava browser at the Sun world conference. major companies such as IBM, Apple, DEC, Adobe, HP, Oracle, Netscape, and Microsoft stopped their related development projects, competed for Java licenses, and developed corresponding Java products for their own products. their own products to develop appropriate Java platforms. [5] [6]
In January 1996, Sun released Java's first development kit (JDK 1.0), an important milestone in the evolution of Java, marking the beginning of Java as a standalone development tool. in September, about 83,000 Web pages were created using Java technology. in October, Sun released the Java platform's first just-in-time (JIT) compiler. In October, Sun released the first Just-In-Time (JIT) compiler for the Java platform.
In February 1997, JDK 1.1 was released, with 220,000 downloads in the next three weeks, and on April 2, the Java One conference was held, with more than 10,000 attendees, the largest conference of its kind in the world at that time, and in September, the Java Developer Connection community surpassed 100,000 members.
December 8, 1998, the second generation of the Java platform, enterprise version of J2EE was released. June 1999, Sun released the second generation of the Java platform (referred to as Java2) of the three versions: J2ME (Java2 Micro Edition, Java2 platform of the micro edition), used in mobile, wireless and limited resource environment; J2SE (Java 2 Standard Edition, the standard version of the Java 2 platform), applied to the desktop environment; J2EE (Java 2Enterprise Edition, the enterprise version of the Java 2 platform), applied to Java-based application servers. the release of the Java 2 platform is the most important milestone in the development of Java. The release of the Java 2 platform is one of the most important milestones in the development of Java, marking the beginning of the popularization of the application of Java.
On April 27, 1999, the HotSpot Virtual Machine was released.The HotSpot Virtual Machine was released as an add-on to the JDK 1.2, and it later became the default virtual machine for JDK 1.3 and all subsequent versions of the Sun JDK[7] .
In May 2000, JDK 1.3, JDK 1.4, and J2SE 1.3 were released, and a few weeks later it received industry-standard support for Apple's Mac OS X. On September 24, 2001, J2EE 1.3 was released, and on February 26, 2002, J2SE 1.4 was released. Since then Java's computing power has increased dramatically, with nearly 62% more classes and interfaces compared to J2SE1.3. Among these new features, extensive XML support, Secure Sockets (Socket) support (via SSL and TLS protocols), a new I/O API, regular expressions, logging and assertions were also provided. on September 30, 2004, J2SE1.5 was released, becoming another milestone in the history of the Java language. To signify the importance of this release, J2SE 1.5 was renamed Java SE 5.0 (internal version number 1.5.0) and codenamed "Tiger". Tiger contains the most significant updates since version 1.0 was released in 1996, including generic support, autoboxing of basic types, Improved loops, enumerated types, formatted I/O, and variable parameters.
One of the founders of Java: James Gosling
In June 2005, at the Java One conference, Sun released Java SE 6. By this time, the various versions of Java had been renamed, having dropped the number 2 from them, such as J2EE was renamed JavaEE, J2SE was renamed JavaSE, and J2ME was renamed JavaME.[8]
On November 13, 2006, Sun, the inventor of Java technology, announced that it was releasing Java technology to the public as free software.Sun officially released the first batch of source code regarding the standard version of the Java platform, as well as the executable source code for the Java mini version. As of March 2007, the Java source code is available for modification by all developers around the world[9] .
In 2009, Oracle announced the acquisition of Sun[10] .In 2010, James Gosling, one of the *** co-founders of the Java programming language, resigned from Oracle.In 2011, Oracle held a global event to celebrate the launch of Java 7, which was then officially released.In 2014, Oracle released the official version of Java 8[11] .
Programming development
Programming environment
Java concept map
The JDK (Java Development Kit), known as the Java Development Kit or Java Development Tools, is a program development environment for writing Applet applets and applications for Java.The JDK is the core of the entire Java JDK is the core of the entire Java, including the Java Runtime Environment (Java Runtime Environment), some of the Java tools and Java's core class libraries (Java API). No matter what Java application server is essentially built-in a certain version of the JDK, the mainstream JDK is Sun's JDK, in addition to Sun, there are many companies and organizations have developed their own JDK, such as IBM's JDK, BEA's Jrocket, and the GNU organization developed JDK [13].
Additionally, the two parts of the Java API library, the Java SE API subset and the Java Virtual Machine, can be collectively referred to as the JRE (Java Runtime Environment), which is the standard environment that supports the running of Java programs[14] .
JRE is a runtime environment, JDK is a development environment. So you need the JDK to write Java programs, and you need the JRE to run Java programs, and the JRE is already included in the JDK, so you can edit Java programs and run them normally as long as you have the JDK installed. However, since the JDK contains a lot of non-runtime related content and takes up a lot of space, you don't need to install the JDK to run a normal Java program, but only need to install the JRE[15] .
Programming tools
Eclipse: an open source, Java-based extensible development platform[16].
NetBeans: an open source Java integrated development environment for a wide range of client and web applications.
IntelliJ IDEA: in the code auto-prompting, code analysis and other aspects of a very good function. [17]
MyEclipse: developed by Genuitec a commercial software , is more widely used Java applications integrated development environment [18] .
EditPlus: If you correctly configure the Java compiler "Javac" and the interpreter "Java", you can use EditPlus to compile and execute Java programs directly[19] .
Language Features
1. Simplicity
Java appears to be designed like C++, but in order to make the language small and easy to familiarize with, the designers removed many usable features of the C++ language, which are seldom used by the average programmer. For example, Java does not support go to statements, providing break and continue statements and exception handling instead. Java also eliminates C++'s operator overload and multiple inheritance features, and does not use a master file, eliminating the need for preprocessors. Because Java has no structures, arrays and strings are objects, so there is no need for pointers.Java can automatically handle object references and indirect references, and realize automatic collection of useless units, so that users do not have to worry about storage management problems, and can spend more time and energy on research and development.
2. Object-oriented
Java is an object-oriented language. For programmers, this means paying attention to the data in the should and the methods of manipulating the data (METHOD), rather than thinking strictly in terms of processes. In an object-oriented system, a class is a collection of data and methods that manipulate the data. Together, data and methods describe the state and behavior of an object. Each object is an encapsulation of its state and behavior. Classes are arranged in a system and hierarchy that allows subclasses to inherit behavior from superclasses. In this class hierarchy there is a root class, which is a class with general behavior.Java programs are organized in terms of classes.
Java also includes a collection of class extensions that form various program packages (Packages) that users can use in their own programs. For example, Java provides classes that produce graphical user interface components (java.awt package), where awt is an acronym for abstract windowing toolkit, classes that handle input and output (java.io package), and classes that support network functions (java.net package).
3. Distributed
Java is designed to support applications over a network; it is a distributed language. Java supports both various levels of network connectivity and reliable streaming network connectivity with the socket class, so users can generate distributed clients and servers.
The network becomes a distributed delivery vehicle for software applications.Java programs can be written once and run everywhere.
4. Compilation and Interpretation
The Java compiler generates byte-code instead of the usual machine code, and Java byte-code provides an architecture-neutral object file format, with code designed to efficiently transport programs to multiple platforms. Java programs can run on any system that implements a Java interpreter and run-time system.
In an interpreted environment, the standard "linking" phase of program development is largely eliminated. If Java has a linking phase, it is the process of loading new classes into the environment, which is incremental and lightweight. As a result, Java supports rapid prototyping and easy experimentation, which leads to rapid program development. It is a compact development process in contrast to the traditional, time-consuming "compile, link, and test".
5. Robustness
Java was originally used as a language for writing software for consumer home electronics, so it was designed to write highly reliable and robust software. java eliminates some of the programming bugs that make it so easy to write reliable software in it.
Java
Java is a strongly typed language, which allows extensions to check for potential type mismatches at compile time.Java requires explicit method declarations; it does not support C-style implicit declarations. These strict requirements ensure that the compiler program catches calling errors, which leads to more reliable programs.
One of the most important enhancements to reliability is Java's storage model. Java does not support pointers, which eliminates the possibility of rewriting storage and error-prone data. Similarly, Java's automatic "useless unit collection" prevents storage leaks and other harmful errors related to dynamic storage allocation and deallocation.The Java interpreter also performs a number of run-time checks, such as verifying that all array and string accesses are within bounds.
Exception handling is another feature of Java that makes programs more robust. An exception is a signal that some kind of error-like exception condition has occurred. Using try/catch/finally statements, the programmer can find the error-handling code, which simplifies the task of error handling and recovery.
6. Security
Java's memory allocation model is one of its main defenses against malicious code. java has no pointers, so programmers can't get insider and fake pointers to memory that are hidden away. What's more, the Java compiler doesn't deal with storage arrangement decisions, so programmers can't look at declarations to guess the actual storage arrangement of a class. Storage references in compiled Java code are determined at runtime by the Java interpreter to determine the actual storage address.
The Java runtime system uses a bytecode verification process to ensure that code loaded onto the network does not violate any Java language restrictions. Part of this security mechanism includes how classes are loaded from the web. For example, loaded classes are placed in separate namespaces rather than localized classes, preventing a malicious small application from replacing standard Java classes with its own version.
7. Portability
Java makes language declarations independent of implementation aspects. For example, Java explicitly states the size of each basic data type and its arithmetic behavior (these data types are described by the Java syntax).
The Java environment itself is portable to new hardware platforms and operating systems.The Java compiler is also written in Java, while the Java runtime system is written in ANSIC.
8. High Performance
Java is a compile-and-interpret language, so it's not as fast as a fully-compiled language. But there are situations where performance is critical, and to support these situations, the Java designers created a "just-in-time" compiler that translates Java byte-code into CPU-specific machine code at runtime, i.e., full compilation.
The Java bytecode format was designed with these "just-in-time" compilation programs in mind, so the process of generating machine code is fairly simple, and it produces pretty good code.
9. Multi-threading
Java is a multi-threaded language that provides support for multi-threaded execution (also known as a lightweight process) that handles different tasks, making it easy to design programs with threads.Java's lang package provides a Thread class, which supports methods for starting threads, running threads, stopping threads, and checking the state of threads.
Java's thread support also includes a set of synchronization primitives. These primitives are based on the supervisor and conditional variable fashions, a widely used synchronization scheme developed by C.A.R. Haore. With the keyword synchronized, a programmer can state that certain methods cannot run concurrently in a class. These methods are under the control of a supervising program that ensures that variables are maintained in a consistent state.
10.Dynamicity
The Java language is designed to adapt to changing environments. For example, classes in Java are loaded as needed, and some are even fetched over the network. [20]
Working Principles
Consists of four aspects:
Working Principles
(1) Java Programming Language
(2) Java Class File Format
(3) Java Virtual Machine
(4) Java Application Programming Interface[21]
When editing and run a Java program, all four need to be involved at the same time. Using text editing software (e.g., Notepad, WritePad, UltraEdit, etc.) or integrated development environments (Eclipse, MyEclipse, etc.) to define different classes in the Java source files[22] , accessing the resource system by calling methods in the classes (which implement the Java APIs), compiling the source files to generate a kind of binary intermediate code, stored in the class file, and then run the class file by running the Java virtual machine corresponding to the operating system platform environment to execute the compiled byte code, call the methods implemented in the class file to meet the program's Java API calls[6].
Language Basics
Basic Data Structures
There are eight data types in Java to store numeric, character, and boolean values.
Integer Types
The integer type is used to store integer values, i.e., values without a decimal part. It can be positive or negative. Integer data has 3 representations in Java programs, decimal, octal and hexadecimal.
Integer data can be categorized into 4 types depending on the size of the content it occupies.
Data types Memory
byte
8-bit
short
16-bit
int
32-bit
Expand all
Float types
Data types Memory
float
32-bit
double
64-bit
Character type
Character types are used to store a single character and occupy 16 bits (two bytes) of memory space. When defining character type variables, they are enclosed in single quotes. Character variables can be defined using the char keyword.
Data types Memory
char
16-bit
Boolean
Boolean, also known as a logical type, defines a Boolean variable with the keyword boolean, which has only two values, true and false, which represent "true" and "false", respectively, in Boolean logic. "and false" in Boolean logic, respectively. Boolean types are often used as judgment conditions in process control.
Keywords
Keywords Meaning
abstract
Abstract class or method
assert
Used to find internal program errors
break
To jump out of a switch or loop
Expand All
Keyword reference source [23]
Operators
Operators are special symbols that are mainly used in mathematical functions, some types of assignment statements, and in logical comparisons.
Assignment Operators
The assignment operator, represented by the symbol "=", is a binary operator (working with two operands) whose function is to assign the value contained in the right operand to the left operand.
For example:
int a = 100;
Arithmetic Operators
Operator Description
+
add
-
diminish
*
multiply
Expand All
Self-Incrementing and Self-Diminishing Operators
Self-increment and self-decrement are unary operators that can be placed before or after an operand. The operand must be an integer or floating-point variable. The increment and decrement operators increase or decrease the value of a variable by 1. The increment and decrement operators placed before the operand first increase or decrease the value of the variable by 1 and then cause the variable to participate in the operation of the expression. Self-increment and self-decrement operators placed after the operand first add or subtract 1 to the value of the variable and then add or subtract 1 to the value of the variable.
For example:
Suppose a=5
b=++a;//first add 1 to the value of a and then assign the value to b. In this case, the value of a is 6 and that of b is 6
b=a++;//first assign the value of a to b and then assign the value to b. In this case, the value of a is 6 and that of b is 6
b=a++;//first add 1 to the value of b and then assign the value to a. value to b, and then change the value of a to 6, then the value of a is 6 and the value of b is 5
Comparison Operators
Comparison operators are binary operators that are used in programs to compare variables with each other, variables with their own variables, and other types of information. The result of a comparison operator is of boolean type. The result of the operation is true when the relationship between the operators is valid, otherwise it is false.There are six comparison operators ***, which are usually used as a basis for judgment in conditional statements.
Operator Description
>
Compare if left is greater than right
<
Compare if left is less than right
==
Compare if left is equal to right
Expand All
Logic Operators
What the operators do
What they do
These are the following.
&&
Logical and
||
Logical or
!
Logical non
Language Fundamentals Reference Source [24]
Program Example
/* A simple Java application that displays the content: Hello World!
The file name is Hello.java*/
class Hello{
/
The program starts with main()
public static void main(String args[]){
System.out.println("Hello World!");
}
}
The main method, as the comment says, this is the first line where the program starts executing. The main method is required for a Java application, and the Java interpreter executes the program without generating any objects, using main as an entry point. Multiple methods can be defined in each class, but there can be only one main method. The keyword public indicates access rights, specifying that all classes can use this method. In this case, main must be defined as public because it needs to be called by code outside of its class when the program starts executing. The keyword static specifies that the method is a class method. The keyword void specifies that the main() method does not return any value. args[], the String defined in parentheses in the main method, is the parameter passed to the main method, named args, which is an object of class String. Arguments to the method are specified by "class name parameter name", and multiple arguments are separated by commas. The last character of the line is "{", which indicates the beginning of the main program body, and all the code contained in a method will be enclosed in these brackets. Also, main is only the place where the interpreter begins its work; a complex program may contain dozens of classes that require only one main method. [25]
Language standards
On November 17, 1997, the International Organization for Standardization (ISO) agreed to adopt Sun's proprietary technology, Java, as an ISO standard.JAVA was made available for public use as a technical standard without charge. Based on ISO's approval, Sun will be able to submit a standardized platform specification for JAVA. [26]
Publication date Name
November 15, 2000
ISO/TS 10303-27:2000
May 15, 2006
ISO/IEC 19777-2:2006
July 15, 2014
ISO/IEC TR 13066-6:2014
Expand All
Language Standards Reference [27] [28] [29] [30] [31]
Language Specification
The JCP (Java Community Process) is an open, international organization of Java developers and licensees, with the function of developing and updating Java specifications, reference implementations (RIs), and technology compatibility kits (TCKs).
The specifications maintained by JCP include Java ME, Java SE, Java EE, XML, OSS, JAIN, and others. Members of the organization can submit JSRs (Java Specification Requests), through a specific process, into the next version of the specification.
JSRs are specific descriptions of early proposals and final releases of the Java platform specification. Typically, a new JSR is proposed to add to or standardize the functionality of the Java platform. A specific JSR is developed by a group of experts*** with the work coordinated by the group leader. For example, CLDC1.0 (Connected Limited Device Configuration, JSR30) was developed by Antero Taivalsaari of Sun as the group leader, while the members of the expert group also included Siemens, Motorola, Nokia, Symbian, etc. The Java ME platform specification is defined in JSR68, and the specification team leader is Sun's Jon Courtney.
After the completion of the JSR, the related specification and JavaAPI will be released on the official website of JCP. Device manufacturers can implement a particular JSR, such as MIDP 2.0 (JSRll8), in their own products. However, these must pass the TCK (Technology Compatibility Kit) test to ensure technology compatibility. [32]
By technology category can be divided into the following categories:
1, J2EE Platform Specification [33]
2, J2SE Platform Specification [34]
3, J2ME Platform Specification [35]
4, Operations Support System Specification (OSS) [36]
5, Integrated Network of Java Applications for Integrated Networks (JAIN) [37]
6, XML Operations Specification [38]
Technology Applications
1, Android Applications
Many Android applications are developed by Java programmer developers. Although Android utilizes a different JVM and a different wrapper, the code is still written in Java. JAVA games are supported in a significant portion of cell phones, which has led many non-programmers to recognize JAVA.
2. Server programs applied in the financial industry
Java is widely used in the financial services industry, and many third-party trading systems, banks, and financial institutions have chosen to develop in Java because of the relative security of Java[39]. . Large multinational investment banks use Java to write front and back office electronic trading systems, settlement and confirmation systems, data processing projects, and other projects. Mostly, Java is used for server-side development, but most do not have any front-end, they usually receive data from one server (upper level), process it and send it to another processing system (next level of processing).
3. Web sites
Java has taken its place in the field of e-commerce as well as web development. Developers can utilize many different frameworks to create web projects, SpringMVC, Struts 2.0, and frameworks. even simple servlets, jsp, and struts-based websites are often used in government projects. For example medical ambulance, insurance, education, defense and other different departmental websites are developed on Java basis.
4, embedded field
Java has a lot of room for development in the embedded field. In this platform, only 130KB is able to use Java technology (on smart cards or sensors).
5, big data technology
Hadoop and other big data processing technologies many of which use Java, such as Apache's Java-based HBase and Accumulo and ElasticSearchas well.
6, high-frequency transactions in the space
The Java platform improves this platform's features and even though compiled, he is at the same time able to pass data like C++. It is for this reason that Java has become the language of choice for programmers writing trading platforms, because although the performance is not as good as C++, developers can bypass issues such as security, portability and maintainability.
7. Scientific Applications
Java is a good choice for scientific applications, including natural language processing. The main reason is because Java is better than C++ or other languages relative to its security, portability, maintainability, and concurrency of other high-level languages.
Java is a good language to learn and difficult to master, and configuring things is more complicated