What’s new in JDK 1.5 over 1.4 !
1. Generics {Compile}
2. Annotations {suppress ,override, deprecated….}
3. Enumerations
4. Variable arguments{void test(String…)}
5. Changes in concurrency utilities.Now includes high-level concurrency APIs.{ java.util.concurrent}
6. Autoboxing and Unboxing
7. Static imports {less keystrokes/time and the same outcomes.}
8. forEach loop {Beautify the existing for loop usage while iterating over collections}
What’s new in JDK 1.6 over 1.5 !
No new Language features
1. Rhino{JavaScript engine} included with java. Feature let the java and script talk to each other.{implements java.script APIs}
2. Support for scripting languages framework like python ruby.
3. Jdbc 4 support provide improved XML support for database.
4. Java DB included with the platform.{Featured,Transactional,Portable,Compact}
5. Jaas support for LDAP-based authentication.
6. Improved memory usage analysis and leak detection
What’s new in JDK 1.7 over 1.6 !
1. try with resource statement.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Test1 { static String readLine(String path) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader("test.txt"))) { return br.readLine(); } } public static void main(String args[]) throws IOException { readLine(""); } } |
2. Switch case on Strings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import java.io.IOException; public class Test1 { public static int getAgeByName(String name) { int age; switch (name) { case "John": age = 20; break; case "Seli": case "shaun": case "jerry": age = 23; break; default: throw new IllegalArgumentException("Name not present " + name); } return age; } public static void main(String args[]) throws IOException { System.out.println(getAgeByName("John")); } } |
3. Type Inference for Generic Instance Creation.
1 2 3 |
Map<String,Integer> tList= new HashMap<>(); can be used instead explicitly stating the types Map<String,Integer> tList1= new HashMap<String,Integer>(); |
4. Static methods to compare byte int long Boolean included .
1 2 3 4 5 6 7 8 9 10 |
import java.io.IOException; public class Test1 { public static void main(String args[]) throws IOException { long a = 1L, b = 2L; System.out.println(Long.compare(a, b)); } } |
5. Calendar class added with useful static methods.
6. Enhancements in Java Reflection.
7. InetAddress.getLoopbackAddress() added.
1 2 3 4 5 6 7 8 9 10 |
public class Test1 { public static void main(String args[]) throws IOException { InetAddress iAddress = InetAddress.getLoopbackAddress(); System.out.println("Name: " + iAddress.getHostName()); System.out.println("Addr: " + iAddress.getHostAddress()); System.out.println(iAddress.isLoopbackAddress()); } } |
8. Changes in ProcessBuilder class.
9. Catch Block Handling Multiple Exceptions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import java.nio.BufferOverflowException; public class Test { public static void main(String args[]) { try { throw new CustomException("Custom Exception"); } catch (NullPointerException | BufferOverflowException | CustomException ex) { System.out.println("caught"); } } } class CustomException extends Exception { public CustomException(String message) { System.out.println(message); } } |
10. NOI.2 API included.{Alternative to Java IO/Networking}
11. API changes in existing elliptic curve encryption.
What’s new in JDK 1.8 over 1.7 !
1. Lambda expressions that benefits in Parallel operations on sorting, operation while iterating collections.
2. Oracle Nashorn{Java + JavaScript engine based on Mozilla Rhino} is included to speedup intercommunication b/w server side javascript[POST request] and Java layer. It is spread as Node JS killer because Node js is doing the same thing with more complex way,
3. New date / time APIs included.
4. Enhancements in Repeated annotations.
\o/
Though it was a very brief explanation, liked the summary of features put on one single post. Would be good if you can link the features as well. 🙂
Well Summarized for a view at a single glance.