Interview Questions and Answers - Order By Rating Rarely asked as it was introduced with Java 8. Q31. Difference between DoubleSummaryStatistics , IntSummaryStatistics and LongSummaryStatistics ? Core Java
Ans. They all does the same task i.e to compute statistical information on the stream of data. They differ by the way they store the statistical information as they expect a different data type of the values being used. IntSummaryStatistics and LongSummaryStatistics expect non floating point values and hence stores the statistical information like min,max and sum as non floating values ( int or long ) whereas DoubleSummaryStatistics stores these information as floating value. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   java 8   lambda expressions   doublesummarystatistics   intsummarystatistics   longsummarystatistics   summarystatisticsNot frequently asked as it was introduced with Java 8. Ans. StringJoiner is a util method to construct a string with desired delimiter. This has been introduced with wef from Java 8.
Sample Code
StringJoiner strJoiner = new StringJoiner ( "." );
strJoiner . add ( "Buggy" ). add ( "Bread" );
System . out . println ( strJoiner ); // prints Buggy.Bread
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   java 8   string   stringjoinerNot frequently asked as it was introduced with Java 8. Ans. Optional is a good way to protect application from runtime nullPointerException in case the the absent value has been represented as null. So basically Optional class provides the type checking during compile time and hence will never result in NPE. For ex - List> intList = new ArrayList>(); intList.add(Optional.empty()); intList.add(Optional.of(new Employee("abc"))); intList.add(Optional.of(new Employee("xyz"))); intList.add(Optional.of(new Employee("123"))); System.out.println(intList.get(0).getName()); So Now , even when the first list element is empty, this code will never throw an NullPointerException. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   java 8   optionalRarely asked as it was introduced with Java 8. Q34. Name few "Optional" classes introduced with Java 8 ? Core Java
Ans. http://www.buggybread.com/2015/01/java-optional-classes-and-interfaces.html Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   optional   java 8   java8Rarely asked as it was introduced with Java 8. Q35. What are the changes in Java.io in Java 8 ? Core Java
Ans. http://www.buggybread.com/2015/01/migrating-to-java-8-new-classes_62.html Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java 8   java.io   java8 Q36. Name few Java Util classes introduced with Java 8 ? Core Java
Ans. http://www.buggybread.com/2015/01/migrating-to-java-8-new-classes_25.html Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java.util   util   java 8   java8Rarely asked as it was introduced with Java 8. Q37. Name few java.lang classes introduced with Java 8 ? Core Java
Ans. http://www.buggybread.com/2015/01/migrating-to-java-8-new-classes.html Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java.lang   java8   java 8Rarely asked as it was introduced with Java 8. Ans. DocLint Provide a means to detect errors in Javadoc comments early in the development cycle and in a way that is easily linked back to the source code. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java 8   doclint   java8 featuresRarely asked as it was introduced with Java 8. Q39. What are the errors identified by DocLint ? Core Java
Ans. Bad syntax, such as unescaped characters or unmatched parentheses Bad HTML, such as invalid or missing tags or attributes Bad references, such as referencing a non-existent type with @see Accessibility errors, such as a missing summary or caption from a table Missing info, such as an undocumented parameter Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   java 8   doclintRarely asked as it was introduced with Java 8. Q40. Which keyword specify that a variable is effectively final ? a. final b. No Keyword c. Both of the above d. None of the above Core Java
Ans. No Keyword Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java 8   java8   final   effectively final   rare Rarely asked as it was introduced with Java 8. Q41. Which of the following has been introduced with Java 8 ? a. StringBuffer b. StringBuilder c. StringFilter d. StringJoiner Core Java
Ans. StringJoiner Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java8   java 8   string   stringjoiner