Current location - Trademark Inquiry Complete Network - Trademark registration - Is Java easy to learn?
Is Java easy to learn?

Java is an object-oriented programming language. It not only absorbs the various advantages of the C language, but also abandons the concepts such as multiple inheritance and pointers that are difficult to understand in C. Therefore, the Java language is powerful, simple and easy to use. Use two features. As a representative of static object-oriented programming languages, Java language perfectly implements object-oriented theory and allows programmers to perform complex programming with an elegant way of thinking [1].

Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, and dynamics [2]. Java can write desktop applications, Web applications, distributed systems and embedded system applications, etc. [3].

Foreign name

Java

Current company

Oracle

Launch time

May 1995

Quick

Navigation

Programming Development

Language Features

Working Principle

Language Basics

Language Standards

Language Specifications

Technical Applications

Study Guide

Language Evaluation

Development History

In the 1990s, single-chip computer systems appeared in the hardware field. As soon as this low-priced system appeared, it immediately attracted the attention of those in the field of automatic control. , because using it can greatly improve the intelligence of consumer electronic products (such as TV set-top boxes, bread ovens, mobile phones, etc.). In order to seize the market opportunity, Sun established a project team called Green in 1991. Patrick, James Gosling, Mike Shelindan and several other engineers formed a working group in the sand dunes of Menlo Park, California. He researches and develops new technologies in a small studio on the road, specializing in computer embedded applications in home appliances.

JAVA

Due to the advantages of C, the researchers of the project team first considered using C to write programs. But for monolithic systems with extremely limited hardware resources, C programs are too complex and large. In addition, due to the variety of embedded processor chips used in consumer electronics products, how to make the written programs run across platforms is also a problem. In order to solve the difficulty, they first focused on language development, assumed a hardware platform architecture with a simple structure that met the needs of embedded applications, and formulated corresponding specifications for it, which defined the binary machine code of this hardware platform. The instruction system (which later became the "bytecode" instruction system) was used to allow semiconductor chip manufacturers to develop and produce this hardware platform after the language was successfully developed. For the design of the new language, Sun's R&D personnel did not develop a brand new language. Instead, they transformed C according to the requirements of embedded software and removed some of the less practical and security-affecting elements left in C. And combined with the real-time requirements of embedded systems, an object-oriented language called Oak was developed.

Since when the Oak language was developed, there was no hardware platform for running bytecode. Therefore, in order to conduct experimental research on this language during development, they based on the existing hardware and software platforms. According to the specifications specified by myself, a running platform was built using software. The entire system is simpler than C, and there is no big difference. In the summer of 1992, when the Oak language was successfully developed, researchers demonstrated the Green operating system, Oak's programming language, class libraries and its hardware to hardware manufacturers to convince them to use the Oak language to produce hardware chips. However, Hardware manufacturers aren't enthusiastic about it. Because they believed that the risk of producing hardware products when everyone knew nothing about the Oak language was too great, so the Oak language was unable to enter the market due to lack of hardware support and was shelved. .

In June and July 1994, after a three-day discussion, the team decided to change the goal of their efforts again, this time they decided 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 they had seen on cable television. As a prototype, Patrick Norton wrote WebRunner, a small World Wide Web browser. [4]

In 1995, the booming development of the Internet gave Oak an opportunity. In order to make rigid and monotonous static web pages "flexible", the industry urgently needs a software technology to develop a program that can be spread through the network and run across platforms. As a result, major IT companies in the world have invested a lot of manpower, material and financial resources in this regard. At this time, Sun remembered the Oak that had been shelved for a long time, and re-examined the test platform written in software. Since it was written according to the embedded system hardware platform architecture, it was very small and especially suitable for networks. The transmission system on the Internet, and Oak is also a streamlined language, the program is very small, suitable for transmission on the network. Sun first launched an Applet that can be embedded in web pages and can be transmitted along with web pages on the network (Applet is a technology that embeds small programs into web pages for execution), and renamed Oak to Java (when applying for a registered trademark, it was discovered that Oak had already been used, and after thinking of a series of names, the Java word was finally used (a Java word the proposer accidentally mentioned while drinking a cup of Java coffee). On May 23, Sun officially released Java and HotJava browsers at the Sun world conference. Major companies such as IBM, Apple, DEC, Adobe, HP, Oracle, Netscape and Microsoft have stopped their own related development projects, competed to purchase Java licenses, and developed corresponding Java platforms for their products. [5] [6]

In January 1996, Sun released Java's first development kit (JDK 1.0). This was an important milestone in the development of Java and marked Java's becoming a an independent development tool. In September, approximately 83,000 web pages were created using Java technology. In October, Sun released the first just-in-time (JIT) compiler for the Java platform.

In February 1997, JDK 1.1 was released. In the following three weeks, it reached 220,000 downloads. On April 2, the Java One conference was held, with more than 10,000 participants, setting a record for the scale of similar conferences in the world at that time. In September, the Java Developer Connection community exceeded 100,000 members.

On December 8, 1998, the enterprise version of the second-generation Java platform, J2EE, was released. In June 1999, Sun released three versions of the second-generation Java platform (referred to as Java2): J2ME (Java2 Micro Edition, a micro version of the Java2 platform), which is used in mobile, wireless and limited resource environments; J2SE ( Java 2 Standard Edition, the standard version of the Java 2 platform), used in desktop environments; J2EE (Java 2 Enterprise Edition, the enterprise version of the Java 2 platform), used in Java-based application servers. The release of the Java 2 platform is the most important milestone in the development of Java, marking the beginning of the popularization of Java applications.

On April 27, 1999, the HotSpot virtual machine was released. When the HotSpot virtual machine was released, it was provided as an add-on program for JDK 1.2. Later, it became the default virtual machine for JDK 1.3 and all subsequent versions of Sun JDK[7].

In May 2000, JDK1.3, JDK1.4 and J2SE1.3 were released one after another, and a few weeks later they received industry standard support for Apple's Mac OS X. On September 24, 2001, J2EE1.3 was released. On February 26, 2002, J2SE1.4 was released. Since then, Java's computing power has been greatly improved. Compared with J2SE1.3, it has nearly 62 more classes and interfaces. Among these new features, it also provides extensive XML support, secure socket (Socket) support (via SSL and TLS protocols), new I/O API, regular expressions, logging and assertions. On September 30, 2004, J2SE1.5 was released, becoming another milestone in the history of Java language development. 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 version 1.0 was released in 1996, including generics Support, autoboxing of basic types, improved loops, enumeration types, formatted I/O and variadic parameters.

One of the founders of Java: James Gosling

In June 2005, at the Java One conference, Sun released Java SE 6. At this time, various versions of Java have been renamed, and the number 2 has been cancelled. For example, J2EE has been renamed JavaEE, J2SE has been renamed JavaSE, and J2ME has been renamed JavaME. [8]

On November 13, 2006, Sun, the inventor of Java technology, announced that it would release Java technology as free software. Sun officially released the first batch of source code for the Java Platform Standard Edition, as well as the executable source code for Java Mini Edition. Starting from March 2007, all developers around the world can modify Java source code[9].

In 2009, Oracle announced its 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 Java7, and then Java7 was officially released. In 2014, Oracle released the official version of Java8[11].

Programming development

Programming environment

Java concept map

JDK (Java Development Kit) is called Java development kit or Java development tool , is a program development environment for writing Java Applets and applications. JDK is the core of the entire Java, including the Java Runtime Environment (Java Runtime Environment), some Java tools and Java's core class library (Java API). No matter what Java application server is, it essentially has a certain version of JDK built-in. The mainstream JDK is the JDK released by Sun. In addition to Sun, there are many companies and organizations that have developed their own JDK, such as JDK developed by IBM, Jrocket by BEA, and JDK developed by the GNU organization [13 ].

In addition, the Java SE API subset and Java virtual machine in the Java API class library can be collectively referred to as JRE (JAVA Runtime Environment). JRE is a standard environment that supports the running of Java programs [14] .

JRE is a running environment, and JDK is a development environment. Therefore, JDK is needed when writing Java programs, and JRE is needed when running Java programs. The JDK already contains JRE, so as long as the JDK is installed, you can edit Java programs and run Java programs normally.

However, since JDK contains a lot of content that has nothing to do with running and takes up a lot of space, there is no need to install JDK to run ordinary Java programs, but only need to install JRE [15].

Programming Tools

Eclipse: an open source, Java-based extensible development platform [16].

NetBeans: Open source Java integrated development environment, suitable for various client and Web applications.

IntelliJ IDEA: It has very good functions in automatic code prompts, code analysis, etc. [17]

MyEclipse: A commercial software developed by Genuitec, it is a widely used integrated development environment for Java applications [18].

EditPlus: If the Java compiler "Javac" and the interpreter "Java" are correctly configured, you can directly use EditPlus to compile and execute Java programs [19].

Language Features

1. Simplicity

Java looks very similar to C, but in order to make the language small and easy to become familiar with, the designers changed C Many available features in the language that are rarely used by average programmers have been removed. For example, Java does not support the go to statement and instead provides break and continue statements as well as exception handling. Java also eliminates C's operator overload (overload) and multiple inheritance features, and does not use the main file, eliminating the need for preprocessors. Because Java does not have structures, arrays and strings are objects, so no pointers are needed. 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 issues 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 application and the methods to manipulate the data, rather than thinking strictly in terms of procedures. In an object-oriented system, a class is a collection of data and methods for operating data. Data and methods together describe the state and behavior of an object. Each object is an encapsulation of its state and behavior. Classes are arranged in a certain system and hierarchy so that subclasses can inherit behavior from superclasses. In this class hierarchy there is a root class, which is the class with general behavior. Java programs are organized using classes.

Java also includes an extended collection of classes, which form various packages (Package) that users can use in their own programs. For example, Java provides classes that generate graphical user interface components (java.awt package), where awt is the abbreviation of abstract windowing toolkit, classes that handle input and output (java.io package), and classes that support network functions. (java.net package).

3. Distribution

Java is designed to support applications on the network. It is a distributed language. Java not only supports various levels of network connections, but also supports reliable stream network connections with the Socket class, so users can generate distributed clients and servers.

The network becomes a distribution vehicle for software applications. Java programs only need to be written once and run anywhere.

4. Compilation and Interpretability

The Java compiler generates byte-code (byte-code) instead of usual machine code. Java bytecode provides an architecture-neutral object file format, and the code is designed to efficiently deliver 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 largely disappears.

If there is a linking stage in Java, it is just the process of loading new classes into the environment. It is an incremental and lightweight process. Therefore, Java supports rapid prototyping and easy experimentation, which will lead to rapid program development. This is an elegant development process that contrasts with the traditional, time-consuming "compile, link, and test."

5. Robustness

Java was originally used as a language for writing consumer home electronics software, so it is designed to write highly reliable and robust software. Java eliminates certain programming errors, making it fairly easy to write reliable software in it.

Java

Java is a strongly typed language, which allows extended compile-time checking for potential type mismatch problems. Java requires explicit method declaration, and it does not support C-style implicit declaration. These strict requirements ensure that the compiler catches calling errors, which results in more reliable programs.

One of the most important enhancements in reliability is Java's storage model. Java does not support pointers, which eliminates the possibility of overwriting storage and corrupting data. Similarly, Java's automatic "garbage collection" prevents storage leaks and other harmful errors related to dynamic storage allocation and deallocation. The Java interpreter also performs many runtime checks, such as verifying that all array and string accesses are within bounds.

Exception handling is another feature in Java that makes programs more robust. An exception is a signal that some abnormal condition, similar to an error, has occurred. Using try/catch/finally statements, programmers can find the error handling code, which simplifies the task of error handling and recovery.

6. Security

Java's storage allocation model is one of its main ways to defend against malicious code. Java has no pointers, so programmers cannot get behind the scenes and fake pointers to memory. More importantly, the Java compiler does not handle storage arrangement decisions, so the programmer cannot guess the actual storage arrangement of the class by looking at the declaration. Storage references in compiled Java code have the actual storage address determined by the Java interpreter at runtime.

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 Internet. For example, loaded classes are placed in separate namespaces rather than local classes, preventing a malicious applet from replacing standard Java classes with its own versions.

7. Portability

Java makes language declarations independent of implementation aspects. For example, Java explicitly states the size and operation behavior of each basic data type (these data types are described by 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 language.

8. High performance

Java is a language that is compiled first and then interpreted, so it is not as fast as a fully compiled language. But there are situations where performance is critical. To support these situations, Java designers created a "just-in-time" compiler, which translates Java bytecode into machine code for a specific CPU (central processing unit) at runtime, as well. That is to achieve full compilation.

The Java bytecode format was designed with the needs of these "just-in-time" compilers in mind, so the process of generating machine code is quite simple, and it can produce pretty good code.

9. Multi-threading

Java is a multi-threaded language. It provides support for multi-threaded execution (also known as lightweight processes), can handle different tasks, and makes programs with clues Designing is easy. Java's lang package provides a Thread class, which supports methods for starting threads, running threads, stopping threads, and checking thread status.

Java's thread support also includes a set of synchronization primitives.

These primitives are based on the widely used synchronization scheme developed by C.A.R. Haore in the supervisory and conditional variable style. Using the keyword synchronized, programmers can indicate that certain methods in a class cannot run concurrently. These methods are under the control of supervisory procedures to ensure that variables are maintained in a consistent state.

10. Dynamics

The Java language is designed to adapt to changing environments. It is a dynamic language. For example, classes in Java are loaded on demand, and some are even obtained over the network. [20]

Working principle

It consists of four aspects:

Working principle

(1) Java programming language

(2) Java class file format

(3) Java virtual machine

(4) Java application programming interface [21]

When editing and When running a Java program, these four aspects need to be involved at the same time. Use text editing software (such as Notepad, WordPad, UltraEdit, etc.) or integrated development environment (Eclipse, MyEclipse, etc.) to define different classes in Java source files [22], by calling classes (these classes implement the Java API) Method to access the resource system, compile the source file to generate a binary intermediate code, store it in the class file, and then run the class file by running the Java virtual machine corresponding to the operating system platform environment, and execute the bytes generated by the compilation The code calls the method implemented in the class file to satisfy the program's Java API call [6].

Language basics

Basic data structures

There are 8 data types in Java to store numeric values, characters and Boolean values.

Integer type

The integer type is used to store integer values, that is, values ??without decimal parts. Can be a positive number or a negative number. Integer data has three representation forms in Java programs, namely decimal, octal and hexadecimal.

Integer data can be divided into 4 types according to the size of the content it occupies.

Data type memory

byte

8 bits

short

16 bits

int

32-bit

Expand all

Floating point type

Data type memory

float

p>

32-bit

double

64-bit

Character type

The character type is used to store a single character, occupying 16 bits (two bytes) of memory space. When defining character variables, use single quotes. Character variables can be defined using the char keyword.

Data type memory

char

16-bit

Boolean type

Boolean type is also called logical type. Boolean type variables are defined through the keyword boolean. There are only two values: true and false, which represent "true" and "false" in Boolean logic. Boolean types are often used as judgment conditions in process control.

Keyword

Keyword Meaning

abstract

Abstract class or method

assert

Used to find internal program errors

break

Jump out of a switch or loop

Expand all

Keyword reference sources [23]

Operators

Operators are special symbols, mainly used for mathematical functions, some types of assignment statements and logical comparisons.

Assignment operator

The assignment operator is represented by the symbol "=". It is a binary operator (processing two operands). Its function is to convert the right The value contained in the operand is assigned to the operand on the left.

For example:

int a = 100;

Arithmetic operator

Operator Description

p>

Add

-

Subtract

*

Multiple

Expand all

Increment and decrement operators

Increment and decrement are unary operators, which can be placed before or after the operand. The operand must be an integer or floating point variable. The function of the auto-increment and auto-decrement operators is to increase or decrease the value of a variable by 1. The auto-increment and auto-decrement operators placed in front of the operand will first increase or decrease the value of the variable by 1, and then make the variable participate in the expression operation. The increment and decrement operators placed after the operand will first make the variable participate in the operation of the expression, 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 it to b. At this time, the value of a The value is 6, the value of b is 6

b=a; //First assign the value of a to b, and then change the value of a to 6. At this time, the value of a is 6, and the value of b The value is 5

Comparison operators

Comparison operators are binary operators and are used between variables, between variables and independent variables, and other types of information in the program. comparison between. The result of the comparison operator is of type boolean. When the relationship corresponding to the operator is established, the result of the operation is true, otherwise it is false. There are 6 comparison operators, which are usually used in conditional statements as the basis for judgment.

Operator Description

gt;

Compare whether the left is greater than the right

lt;

Compare Whether the left is less than the right

==

Compare whether the left is equal to the right

Expand all

Logical operators

p>

Operator Function

amp;amp;

Logical AND

||

Logical OR

!

Logical NOT

Language basic reference source [24]

Program example

/*A simple Java application that displays 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!");

}

}

main method, as the comment says, this is the program Start the first line of execution. For a Java application, the main method is necessary. The Java interpreter uses main as the entry point to execute the program without generating any objects. Multiple methods can be defined in each class, but there can only be one main method. The keyword public indicates access rights, indicating 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 indicates that the method is a class method. The keyword void indicates that the main() method does not return any value. The String args[] defined in the parentheses of the main method is the parameter passed to the main method. The parameter name is args, which is an object of class String.

The parameters of the method are specified with "class name parameter name", and multiple parameters are separated by commas. The last character of this line is "{", which indicates the beginning of the main program body. All the code contained in a method will be included between this pair of curly braces. In addition, main is only the place where the interpreter starts working. A complex program may contain dozens of classes, but these classes only need one main method. [25]

Language standards

On November 17, 1997, the International Organization for Standardization (ISO) agreed to adopt Sun's patented technology - Java as an ISO standard. JAVA as a technical standard is available to the public for free use. Based on ISO approval, Sun will be able to submit JAVA's standardized platform specifications. [26]

Release time name

November 15, 2000

ISO/TS 10303-27: 2000

2006 May 15

ISO/IEC 19777-2:2006

July 15, 2014

ISO/IEC TR 13066-6:2014

p>

Expand all

Language Standard Reference Materials[27] [28] [29] [30] [31]

Language Specification

JCP (Java Community Process) is an open international organization, mainly composed of Java developers and licensees. Its function is to develop and update Java technical specifications, reference implementation (RI), and technology compatibility kit (TCK).

The specifications maintained by JCP include Java ME, Java SE, Java EE, XML, OSS, JAIN, etc. Organization members can submit JSR (Java Specification Requests) and enter the next version of the specification after passing a specific procedure.

JSR is a detailed description of the early proposed and final published Java platform specification. Usually, a new JSR is proposed to increase or standardize the functionality of the Java platform. A specific JSR is jointly formulated by an expert group, and the work is coordinated by the team leader. For example, CLDC1.0 (Connected Limited Device Configuration, JSR30) is led by Antero Taivalsaari of Sun Company, and members of the expert group also include Siemens, Motorola, Nokia, Symbian, etc. The Java ME platform specification is defined in JSR68, and the specification team leader is Jon Courtney of Sun.

After the JSR is completed, the relevant specifications and JavaAPI will be released on the official website of JCP. Device manufacturers can implement a certain JSR in their products, such as MIDP2.0 (JSRll8). But these must pass TCK (Technology Compatibility Kit) testing to ensure technical compatibility. [32]

It can be divided into the following categories according to technical categories:

1. J2EE platform specification [33]

2. J2SE platform specification [34]

3. J2ME platform specification [35]

4. Operation support system specification (OSS) [36]

5. Java application for integrated network (JAIN) [37]

6. XML operating specifications [38]

Technical applications

1. Android applications

Many Android applications It is developed by Java programmers developers. Although Android uses different JVMs and different packaging methods, the code is still written in Java language.

A considerable number of mobile phones support JAVA games, which makes many non-programmers familiar with JAVA.

2. Server programs used in the financial industry

Java is widely used in the financial services industry. Many third-party trading systems, banks, and financial institutions choose to use Java for development because Relatively speaking, Java is safer [39]. Large multinational investment banks use Java to write front-end and back-end electronic trading systems, settlement and confirmation systems, data processing projects, and other projects. In most cases, Java is used for server-side development, but most of them do not have any front-end. They usually receive data from a server (upper level), process it and send it to another processing system (lower level processing).

3. Website

Java occupies a certain position in the field of e-commerce and website development. Developers can use many different frameworks to create web projects, SpringMVC, Struts2.0 and frameworks. Even simple servlets, jsp and struts based websites are often used in government projects. For example, websites for medical aid, insurance, education, defense and other different departments are developed based on Java.

4. Embedded field

Java has great room for development in the embedded field. On this platform, only 130KB can be used to use Java technology (on smart cards or sensors).

5. Big data technology

Many Hadoop and other big data processing technologies use Java, such as Apache's Java-based HBase and Accumulo and ElasticSearchas.

6. The space of high-frequency trading

The Java platform has improved the characteristics of this platform and even if it is compiled, it can also pass data like C. It is for this reason that Java has become the language of choice for programmers to write trading platforms, because although the performance is not as good as C, developers can avoid 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 that Java has better security, portability, maintainability, and concurrency than other high-level languages ??than C or other languages.

The Java language is easy to learn but difficult to master, and configuration is complicated