Sea the moon, 天涯共此时.
Java
Is 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 Java
code can support Java
running on all platforms without recompiling.
For example, you can in UNIX
the writing and compiling Java
programs, and Microsoft Windows
, Macintosh
or UNIX
run it on your computer, without having to make any modifications to the source code. WORA
By the Java
realized program is compiled into an intermediate language called bytecode. Platform-independent bytecode format. It referred to as Java
a virtual machine ( JVM
VM) for operating on each platform bytecode.
Java's history
Java
Was originally developed by Sun Microsystems
the James Gosling
developed (later Oracle Corporation
acquired), and in 1995 as a Sun Microsystems
Java
publishing platform core components. Most of the syntax of the language from C
and C ++
, but it's simpler than any of them to learn.
In the acquisition of January 27, 2010 Sun Microsystems
after Oracle Corporation
becoming Java SE
the current owner of the official platform implementation. This implementation is based on Sun
the original Java
implementation. Oracle
Implementation suitable for Microsoft Windows
, Mac OS X
, Linux
and Solaris
.
Oracle
Achieve packaged into two different releases:
Java
Runtime Environment (JRE
), contains runJava
the desired programJava SE
platform part, most users face.Java Development Kit(JDK
), For software developers, includingJava
compilers,Javadoc
,Jar
and debugger and other development tools.
Garbage Collection
Java
Use automatic garbage collector to manage the life cycle of the object in memory. Programmers only need to determine when to create an object, and Java
is 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. Java
Impossible 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
Java
Public class source file must contain their name, and additional suffixes.java
, for exampleHelloWorldApplication.java
.- You must first use the
Java
compiler to be compiled into byte code, thereby generating a namedHelloWorldApplication.class
file. The only way to execute or "Start." - 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.
- 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.
??? attention to micro-channel public number java dry
from time to time information sharing Dry
Original link: the What IS the Java Programming Language?