a java tutorial series: What is the Java language?

Sea the moon, 天涯共此时.

Here Insert Picture Description

JavaIs a general-purpose computer programming language, which has excellent versatility, efficiency, platform portability and security. It is designed to allow application developers “write once, run anywhere”( WORA), which means that the compiled Javacode can support Javarunning on all platforms without recompiling.

For example, you can in UNIXthe writing and compiling Javaprograms, and Microsoft Windows, Macintoshor UNIXrun it on your computer, without having to make any modifications to the source code. WORABy the Javarealized program is compiled into an intermediate language called bytecode. Platform-independent bytecode format. It referred to as Javaa virtual machine ( JVMVM) for operating on each platform bytecode.

Here Insert Picture Description

Java's history

JavaWas originally developed by Sun Microsystemsthe James Goslingdeveloped (later Oracle Corporationacquired), and in 1995 as a Sun Microsystems Javapublishing platform core components. Most of the syntax of the language from Cand C ++, but it's simpler than any of them to learn.

In the acquisition of January 27, 2010 Sun Microsystemsafter Oracle Corporationbecoming Java SEthe current owner of the official platform implementation. This implementation is based on Sunthe original Javaimplementation. OracleImplementation suitable for Microsoft Windows, Mac OS X, Linuxand Solaris.

OracleAchieve packaged into two different releases:

  1. JavaRuntime Environment ( JRE), contains run Javathe desired program Java SEplatform part, most users face.
  2. Java Development Kit(JDK), For software developers, including Javacompilers, Javadoc, Jarand debugger and other development tools.

Garbage Collection

JavaUse automatic garbage collector to manage the life cycle of the object in memory. Programmers only need to determine when to create an object, and Javais responsible for the recovery of memory when objects are no longer using the runtime. Once there is no reference to the object, inaccessible memory is eligible to be automatically released garbage collector.

If the programmer's code holds a reference to an object is no longer needed, it is usually similar to a memory leak happens, usually when no longer needed objects stored in the container is still in use. If you call an object method does not exist is thrown “NullPointerException”.

Garbage collection may occur at any time. Ideally, it will happen when the program is idle. If the heap is not enough memory available to allocate a new object, you can ensure that the trigger; this may cause the program to stall temporarily. JavaImpossible explicit memory management.

Java Hello world

Traditional “Hello,world!”programs can be written in Java:

public class HelloWorldApplication {
    public static void main(String[] args) {
        System.out.println("Hello World!");     // Prints Hello World! to the console.
    }
}

Java class files

  1. JavaPublic class source file must contain their name, and additional suffixes .java, for example HelloWorldApplication.java.
  2. You must first use the Javacompiler to be compiled into byte code, thereby generating a named HelloWorldApplication.classfile. The only way to execute or "Start."
  3. Java source files may contain only one public class, but it can contain multiple classes and any number of public inner class does not have public access.
  4. When the source file includes a plurality of classes, a class to set “public”, and using the common name of the class source file name.

Here Insert Picture Description

??? attention to micro-channel public number java dry
from time to time information sharing Dry

Original link: the What IS the Java Programming Language?

Published 112 original articles · won praise 90 · Views 350,000 +

Guess you like

Origin blog.csdn.net/dandandeshangni/article/details/100981536