Java the way of the Gods (1)-Language introduction

Source: Internet
Author: User

Introduction to the Java language

1.Java 's History

I personally think that learning a technology, not only to focus on the technology itself, but also to understand the history of its development, this aspect is the technology itself respect, on the other hand, but also hope that the development of the technology in the past to speculate on its possible future development trend, so as to be able to quickly one step.

For specific information see: http://blog.csdn.net/djsl6071/article/details/1681567

2.Java the characteristics

Java features simple, object-oriented, distributed, interpreted, reliable, secure, platform-independent, portable, high-performance, multi-threading, dynamic, and so on.

Below we will highlight the Java language object-oriented, platform-independent, distributed, multi-Threads, reliability, and safety features.
   1.Object Oriented
Object-oriented is actually a natural extension of the real-world model. Any entity in the real world can be seen as an object. Objects interact with each other through messages. In addition, any entity in the real world can belong to a certain kind of thing, and any object is an instance of a certain kind of thing. If the traditional process programming language is the process-centric algorithm-driven, the object-oriented programming language is object-centric with message-driven. In the formula, the programming language is: program = algorithm + data; object-oriented programming language: Program = object + message.
All object-oriented programming languages support three concepts: encapsulation, Polymorphismand inheritance, Java is no exception. Objects in the real world have properties and behaviors, which are mapped to computer programs, and properties represent the object's data, and the behavior represents the object's method (which is to process data or interact with the outside world). The so-called encapsulation, is to use an autonomous framework to the object of data and methods together to form a whole. It can be said that the object is a means of supporting encapsulation, is the basic unit of encapsulation. The Java language is more encapsulated because Java has no full variables, no main functions, and most of the members in Java are objects, except for simple numeric types, character types, and Boolean types. For these types, Java also provides the appropriate object types to interoperate with other objects.
   polymorphicSex is a variety of forms, specifically, can be used "an external interface, a number of internal implementation methods" expressed. As an example, the computerStackYou can store data in a variety of formats, including integer, floating-point, or character. The algorithm implementation of the stack is the same regardless of what data is stored. For the differentData Type, programmers do not have to choose manually, just use the uniform Interface name, the system can be automatically selected.operator Overloading(Operatoroverload) has been considered an excellent polymorphic mechanism, but because it makes the program difficult to understand, Java finally cancels it.
Inheritance refers to the properties and methods of an object that directly use another object. In fact, many of the entities we encounter have the meaning of inheritance. For example, if you consider a car as an entity, it can be divided into multipleChild Entities, such as: trucks, buses and so on. These sub-entities have the characteristics of cars, so cars are their "fathers", and these sub-entities are "children" of cars. Java provides the user with a series of classes (Class), Java classes have hierarchies, subclasses can inherit the properties and methods of the parent class. Unlike some other object-oriented programming languages, Java only supports single inheritance.
   2.Platform Agnostic
Java is a platform-agnostic language, meaning that applications written in Java can run on different hardware and software platforms without modification. There are two types of platform independence: source and target code levels. C and C + + have a certain degree of source-level platform-independent, indicating that applications written in C or C + + can be run on different platforms without modification by simply recompiling.

Java is largely based on the Java Virtual Machine (JVM) to achieve platform independence at the target code level. The JVM is an abstract machine attached to a specificOperating Systemitself has a set of virtual machine instructions, and has its own stack,Register DeviceGroups and so on. But the JVM is usually implemented on software rather than hardware. (At present, Sun Systems has designed and implemented the Java chip, mainly used inNetwork ComputerNC.
In addition, the advent of Java chips makes it easier for Java to embedHousehold AppliancesIn The JVM is a Java platform-independent Foundation, and on the JVM there is a JavaInterpreterUsed to explain JavacompilerThe compiled program. After the Java programmer finishes writing the software, the Java compilersource programThe byte code compiled into the JVM. Any machine with a Java interpreter can run the program, regardless of the platform on which the bytecode is generated. In addition, Java uses a data type that is based on IEEE standards. The consistency of data types ensured by the JVM also ensured the platform independence of Java.
The platform-agnostic nature of Java has far-reaching implications. First, it allows the programmer toDreamEvents (developing a software run on any platform) becomes a fact, which will greatly accelerate and facilitate the development of software products. Secondly, the platform independence of Java caters to the idea of "network computer". If a large number of commonly used applications (such as word processing software, etc.) are rewritten in Java and placed on an Internet server, then users with NC will not need to use a lot of space to install software, they only need a
Java interpreter, whenever you need to use some kind of application software, download the software's byte code, the results can also be sent back to the server. At present, several companies have begun to use this new computing model to build their ownEnterprise Information System。
3.Distributed
Distributed includes data distribution and operation distribution. Data distribution refers to the data can be scattered across the network of different hosts, operation distribution refers to a computation scattered on different host processing.
Java supports the WWW client/server compute mode, so it supports both distributions. For the former, Java provides an object called a URL, which allows you to open and Access objects with the same URL address, accessing the localFile SystemSame. For the latter, Java applet applets can be downloaded from the server to the client, that is, part of the computation on the client, improve system execution efficiency.
Java provides a full set of network class libraries that developers can use to networkProgramming, it is convenient to realize the distributed characteristics of Java.
   4.Reliability and Safety
Java was originally designed to be used in electronic consumer products and therefore required high reliability. Java comes from C + +, but it eliminates many of the C + + unreliable factors that can prevent many programming errors. First, Java is a strongly typed language that requires explicit method declarations, which ensures that the compiler can find method invocation errors and ensure that the program is more reliable; second, Java does not support pointers, which prevents unauthorized access to memory; Thirdly, the automatic unit collection in Java prevented memory loss, etc.Dynamic MemoryThe problem is caused by the assignment, and the Java interpreter runtime checks to see that the array and string accesses are out of bounds, and finally, Java providesException HandlingMechanismProgrammerA set of error codes can be placed in one place, simplifying error handling tasks for easy recovery.
Because Java is primarily used for web application development, there is a high level of security requirements. Without security assurances, it is dangerous for users to download programs from the network. Java, through its own security mechanisms to prevent the generation of virus programs and download programs to the local system threat destruction. When the Java bytecode enters the interpreter, it must first be checked by the bytecode checker, then the Java interpreter will determine the memory layout of the class in the program, and then the class loader is responsible for loading the classes from the network into separate memory areas to avoid interference between the applications. Finally, the client user can also restrict the classes that are loaded from the network to access only certain file systems.
Together, these mechanisms make Java a safe programming language.
   5.Multithreading
A thread is a new concept of the operating system, which is also known as a lightweight process, which is a smaller unit of concurrent execution than a traditional process.
C and C + + Adopt a single-threaded architecture, while Java provides multithreading support.
Java supports multithreading in two ways. On the one hand, the Java environment itself is multithreaded. Several system threads are responsible for the necessary system-level operations such as useless unit recycling, system maintenance, and so on, on the other hand, the Java language built-in multithreading control can greatly simplify the development of multithreaded applications. Java provides a class thread, which is responsible for starting the run, terminating the thread, and checking the thread state. Java threads also include a set of synchronization primitives. These primitives are responsible for concurrency control of threads. With Java's multithreaded programming interface, developers can easily write applications that support multithreading and improve program execution efficiency. It is important to note that Java's multithreading support is limited to a certain extent by the runtime support platform. For example, if the operating system itself does not support multi-threading, the multithreaded nature of Java may not show up.

3.Java the operating principle

There are two main types of programming languages:

· Compile type: Participate in Baidu Encyclopedia (Http://baike.baidu.com/view/1284280.htm?fr=aladdin)

· Explanation Type: Participate in Baidu Encyclopedia (Http://baike.baidu.com/view/1760224.htm?fr=aladdin)

Because of the presence of an interpreter, programs developed in the Java language can be used on various platforms.

A Java program needs to be compiled (automatically provided by the JDK command: Javac execution), after compilation will form a byte-code file (*.class), then the interpretation of the execution (by the JDK automatically provided by the command: Java execution), and then on the computer to run the program display.

However, at this point the computer is not a physically existing computer, but a virtual computer (a Java virtual machine) that is simulated by software and hardware.

It can be found that all *.class files actually end up not operating systems, but JVM bindings on the operating system, relying on the JVM to perform, and the JVM adapting to different operating systems.

After Windows XP does not support Java, the main reason is to remove the JVM from the operating system.

4.Java the focus of learning

① Basic Syntax

② has the idea of object-oriented programming

③I/O, multithreaded programming, network programming

④ Data structure

Java the way of the Gods (1)-Language introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.