Wednesday, February 16, 2011

Java language features - Lemon brother

 1.
Although Java is an object-oriented C + + based, but by contrast, Java is a more a natural extension of things in the world can be seen as objects. objects interact via messages between the real world of any entity to incorporate into certain things, and therefore any object is an instance of a class of things, if the traditional procedural programming language is central to the process as if driven algorithm, object-oriented programming language is based on object-centric to message-driven. with a formula, process, programming language: program = algorithm + data; for object programming languages: Program = objects + messages.
object-oriented languages support three concepts: encapsulation, polymorphism and inheritance, Java is no exception. the real world objects have properties and behavior, mapping to the computer procedure, the property is that all field data object, that object's method behavior (the role of method of processing data or interact with the outside world). The so-called package, is to use a self-frame to the object data and methods associated with the formation of a whole. can be said that the object is a means to support the package is the basic unit of encapsulation. Java language package is strong, because the Java no global variables, no main function in Java, most of the members of an object, only a simple numeric types, character types, and Boolean types excluded. and for these types, Java also provides the corresponding object type in order to interact with other objects.
Alan Kay has concluded the first successful object-oriented language, Java is also Smalltalk language is based on one of the five basic characteristics of:
1 everything is an object. will be regarded as peculiar variable objects, which can store data, in addition, you can ask it to perform operations on its own. In theory, you can extract any notion of the unknown problem conceptualization component (dogs, buildings, services, etc.), be expressed as a program object.
2 program is a collection of objects, by sending a message to inform them to do with each other. To request an object, you must send a message to the object. More specifically, the message can be thought of as a particular object method call requests.
3 each object has their composition by the storage of other objects. In other words, you can create a package containing existing objects the way to create new types of objects. Therefore, the program component in the complex system, while keeping its complexity hidden in the Behind the simplicity of the object.
4 each object has its type. in accordance with the general statement, ; is the receiving the same message. This is a meaningful expression, such as as The language is written using Java programs without modification on different hardware and software platforms. Java virtual machine to introduce the principle, and running on a virtual machine, Java interfaces to achieve between different platforms. using programs written in Java world shared within. Java data types and machine-independent, Java Virtual Machine (Java Virtual Machine JVM). JVM is an abstract machine, which attached to the specific operating system, itself a virtual machine instructions, and has its own stack, registers and so on. but the JVM is usually not in the hardware vendors to achieve. JVM is a Java platform-independent basis, in the JVM, there is a Java interpreter to explain the Java compiler to compile the program after. Java programmers After the software is in preparation, through the Java compiler compiles Java source JVM byte code. as long as any machine with a Java compiler, you can run the program, regardless of what this byte code is generated by the platform. In addition, Java uses a class based on IEEE standard data types, data types through the JVM to ensure consistency, but also to ensure that the Java's platform independence.
when running Java programs, he is first compiled into byte code. byte code is very similar to machine instructions, so the Java program is very efficient. However, the byte code does not turn on a particular machine, so no need to recompile the Java program can be in many executed on different computers .
Java source code is compiled into class files, his performance is equivalent to byte code program. in a Java class files, all of the methods and the strength of the name according to the reference variable, and at first when executing code be resolved. This makes the code more general, more susceptible to the impact of changes, but remain high
3. the safety and reliability
Java was originally designed for electronic consumer products, thus requiring higher reliability. Java programming like C + +, Learning through C + + programmers will quickly master the Java essence. Java abandoned the C + +, that for the memory address of the direct operation, the program runs, the memory by the operating system distribution, to avoid the virus invade the system through the pointer. Java provides security to the program manager, to prevent unauthorized access to the program.
Java is a strongly typed language, asked to show the method declaration, which guarantees the compiler to call the wrong method can be found to ensure the procedures more reliable.
Java's garbage collection mechanism to prevent memory loss and other problems caused by dynamic memory allocation.
Java run-time compiler, an inspection can be found in the array and string access out of bounds.
Java provides the exception set mechanism, the programmer can put a wrong code in one place, so that error-handling tasks can be simplified to facilitate recovery.
because Java is mainly used for web application development, and therefore have higher security requirements. If you do not security assurances, users download the program from the network implementation is very dangerous. Java through its own security mechanism to prevent the virus ascending and the generation and download the threat of destruction of the local system. When the Java interpreter into its own, the first byte code must be check check for a school, and then, Java compiler will determine the type of memory distribution of the program, then, the class loader responsible for loading the class from the network to a separate memory area, to avoid mutual interference between the destruction process. Finally, client users can also limit the classes loaded from the network file system can only access some.
4.
Concurrent multi-threaded operating system thread is a new concept, it is called light-weight process , is smaller than the traditional process can be concurrently executing units.
C and C + + with single-threaded architecture, the Java multithreading support is provided. Java supports multi-threaded in two ways. On the one hand, Java environment itself is multithreaded. a number of threads to run the system responsible for the necessary garbage recovery, system maintenance, system-level operation; the other hand, Java language built-in multi-threaded control that can greatly simplify multi-threaded application development. Java provides a class Thread, which is responsible for starting the operation, termination of the thread, and check the thread state. Java's thread also includes a set of synchronization primitives. these primitives is responsible for the implementation of concurrency control on the thread. using multi-threaded Java programming interface, developers can easily have to write multithreaded applications, improve the efficiency of program execution. must be attentively 是, Java multi-threading support to some extent by the limited run-time support platform. For example, if the operating system itself does not support multi-threaded, Java's the performance of multi-threaded features may not come out.
5. Distributed
distributed operations, including data distribution and distribution. data distribution refers to the data can be distributed on different hosts in the network, the operation of a distribution refers to the distributed computing processed on different hosts.
Java support WWW client / server computing model, therefore, it supports both distributed. For the former, Java provides an object called the URL, use this object, you can open and URL address to access the same object, access mode and access the same local file system. For the latter, Java's applet applets can be downloaded from the server to the client, that is part of the calculation on the client side to improve the efficiency of the system.
Java class library provides a set of networks, developers can use libraries for network programming, easy to get to achieve the distributed nature of Java.
6.Java
small programs can be written with two types of Java programs : small program (also known as JavaApplet) and applications (JavaApplication). applet is embedded in the HTML document Java programs; the Java application is run from the command line program. on Java terms, Java applets on the size and Complexity is no limit. In fact, Java applets in some respects more powerful than Java applications. However, due to the current speed of Internet communication is limited, so most small program size smaller. applets and applications that run technical differences between environment.
Java application running in the most simple environment, it is the only external input is the command line arguments. On the other hand, Java applets from a Web browser, you will need a lot of information: it needs to know when start, when placed in the browser window, where, when activated to close. As the two different execution environments, small procedures and minimum requirements for different applications.
the WWW to make a small program is distributed in a very convenient therefore better suited as a small program application on the Internet. On the contrary, non-network systems and memory system is more suitable for smaller applications and less Java Applet with Java. In addition, Java applications can also be easy for Internet-based environment, in fact, some excellent Java application that is the case.
iPhone 5 or 4-inch screen with an angry bird recipe for success: design is simple but difficult to master Cheng Binghao: iOS 4.3 iPad Daily free until the end of simplification (software) products, practical steps should have known 7 IntelliTrace JavaScript skills to use VS2010 to debug ASP.NET MVC3 Service Location Silverlight game development tips: dynamic product owner is also a small menu should be a Scrum coach? More Knowledge Base article ... China-pub computer books online store! 65,000 varieties of 2-8 off! China-Pub computer print books on-demand printing services in February 2011 (2) 1. Re: JAVA Language History 2. Re: Java Language Features 1. JAVA language, history (28) 2. Java language features (9) 1. Java language features (1) 2. JAVA language, history (1)

No comments:

Post a Comment