The release of the Java version of almost all platforms involves all aspects of the Java language itself and the JVM. So for Java 7, from the JSR draft, we get the high-level goal of Java 7:
Compatibility-Any program running on previous versions must be able to run in Java SE 7 without making any changes; development efficiency--improve development efficiency, minimal learning curve, performance--New parallel API interface, introducing a real asynchronous I/O API that makes I/O-intensive applications have better performance Applicability-the ability to speed up the performance of other dynamic languages on a Java virtual machine; ―java SE 7 will include a new, flexible file system API as part of the JSR203.
Basic new features of Java 7
Enhancements to the Java language features (JSR334)
Project Coin mainly makes some minor improvements to the Java language to improve the productivity of the Java http://www.aliyun.com/zixun/aggregation/7155.html "> developers:
String Type Listing 1 is allowed in the Switch statement. String type examples are allowed in Switch statements
Switch (myString) {case ' one ': <do something>; break, Case "nonblank": <do something, else>; break; Default: <do Something generic>; Provides type inference listing 2 for the creation of a generic type instance. Provides type inference examples for creating common type instances
map<string,mytype> foo = new map<string,mytype> (); Becomes:map <String,MyType> foo = new map<> (); Multi Catch to handle a variety of exception types listing 3. Multi Catch to handle a variety of exception types examples
Java 6:try {...} catch (Exception a) {handle (a);} catch (Error b) {handle (b);} Java 7:try {...} catch (Exception | Error a) {handle (a);} Binary and numeric constants examples
0b10011010 34_409_066
Automatic resource management mechanism
In Java programs, handling all possible failure paths is difficult, and closing resources is also relatively difficult, so in the Java 7 implementation, resource management obtains the help of compilers, by defining a resource interface that allows the compiler to automatically shut down resources when appropriate, freeing up resources such as memory.
Automatic Resource Management Example
Try (inputstream inFile = new FileInputStream (afilename); OutputStream outfile = new FileOutputStream (afilename)) {byte] buf = new byte[buf_size]; int readbytes; while (readbytes = Infile.read (BUF)) >= 0) infile.write (buf, readbytes); }
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.