Search code examples
java-8jdk6

Comparison between jdk1.6 and jdk1.8 code with Example


I would like to understand how jdk1.8 code is, as compared to code of jdk1.6

Can anyone provide an example, or a link??

Thanks

I want to see a comparison between code written in java6 and cod written in java8,

to understand the features of java8 and how it simplifies the code

I just need an example of a program written in java6 , against a program written in java8


Solution

  • There are many features available in Java 8 and code enhancement that was not available in java 6.

    A useful compiler feature that is added in Java 7 is the 'diamond operator'. E.g, instead of typing

    ArrayList<Integer> arrInt = new ArrayList<Integer>();
    

    You could just type

    ArrayList<Integer> arrInt = new ArrayList<>();
    

    In Java 8 many features are available. For further details you may visit mentioned links

    https://www.javacodegeeks.com/2014/03/8-new-features-for-java-8.html

    http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html