Beginning JDK 8, we can have a default method implementation in an interface. So, what happens when a class inherits a method with same signature from a superclass and an interface ? Answer If a class inherits a method (abstract or concrete) from its superclass and a method with the same signature from one …
Continue reading Java 8 quiz on multiple inheritance with default Interface methodJava Quiz
What will be the output of following quiz on Integer Comparison ? Answer When we assign a literal number to Integer, compiler adds Integer.valueOf for the literal. For example, Integer i1= -128 becomes Integer i1= Integer.valueOf(-128) In valueOf implementation, by default integers -128 to 127 are cached and the cached instance is …
Continue reading Java quiz on Integer ComparisonWhat will be the output of following quiz on String concatenation ? Answer Here are some rules for this : 1) When one of the operands in + is string, its concatenated. The result is a String. 2) When both operands are numbers, numbers are added. 3) The operation is evaluated from …
Continue reading Java quiz on String concatenationWhat will be the output of following quiz on ArrayList ? © 2016, https:. All rights reserved. On republishing this post, you must provide link to original post Popular Articles you may like : Java 8 Interview Questions RESTful CRUD operations using Jersey and Hibernate Frequently asked Java Programming Interview questions on …
Continue reading Java Quiz 38 ( ArrayList)We know Set implementations don’t contain duplicates. So, how many objects are in the below HashSet ? © 2016, https:. All rights reserved. On republishing this post, you must provide link to original post Popular Articles you may like : Java 8 Interview Questions RESTful CRUD operations using Jersey and Hibernate Frequently …
Continue reading Java Quiz 37 (Set with duplicates)