In Java 8 - Find average of all between 1 to 5










Program/ Example -
     //In Java 8 - Find average of all between 1 to 5
       //Use streams
       OptionalDouble average = IntStream.of(1, 2, 3).average();  //n.e. 1 + 2 + 3 + 4 + 5
       System.out.println("average = "+average.getAsDouble());
       


Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.





eEdit
Must read for you :