HTML

Default Methods in Interface, Multiple Inheritance and Diamond Problem in Java 8

Ever since Java 8 introduced default and static methods in JDK 8, it's become possible to define non-abstract methods in interfaces and since in Java one class can implement multiple interfaces and because there can be concrete methods in interfaces, the diamond problem surfaced again. What will happen if two interface has methods o the same name and a Java class inherit from it? Many Java programmer also asks me the question that, is Java 8 is also supporting multiple inheritances of classes, as it seems because interface with methods is similar to abstract class or in that any class. Well, it’s not.

Java 8 Default Methods On Interface : What, Why and Example

Whenever someone talks about Java 8, the first thing he speaks about is lambda expression and How lambda expression will change the way you use Collections API today. In truth, lambda expression would not be that useful had language not been enhanced to support default methods on Java Interface. Also known as a virtual extension or defender methods, they allow you to declare a non-abstract method inside Java interface. Which means, finally you can add new methods without breaking all classes, which implements a certain interface. This opens a new path for enhancing and evolving existing Collection API to take advantage of lambda expressions. For example, now you can iterate over all elements of Collection in just one line, as opposed to four lines it requires you to do prior to Java 8.

Difference between Abstract class and Interface in Java 8 with Default Methods

Ever since JDK 8 has allowed concrete methods on interface e.g. default and static methods, many of my readers have asked me how should they answer the classical abstract class vs interface questions. In this post, I'll revisit this hugely popular Java interview question in light of Java 8 changes. Before JDK 8, the level of abstraction was the clear cut difference between abstract class and interface i.e. interface was the purest form of abstraction which only define what interface is supposed to do without specifying how i.e. it only declare API methods and leave implementation to its subclasses.  All methods of an interface were abstract but since Java 8 you can define non-abstract methods in form of default and static methods inside interface in Java.

Top 5 Free Spring Certification Mock Exams and Practice Questions

Many Java developers don't know that similar to Oracle's Java certification, there is also a Spring certification program, which certifies yourself for your Spring framework skill. There are three Spring certifications currently available, Spring Professional certification exam, which certifies on your general knowledge about Spring framework, Spring Web Application Developer exam, which certifies you about your Spring MVC skill and Spring Enterprise Integration Specialist certification exam, which is for advanced Spring Integration skill. Earlier, SpringSource provides this company but now they are provided by Pivotal, the company behind Spring framework.

7 Free 1Z0-803 and 1Z0-804 Sample Questions - OCAJP 7 and OCPJP 7 Mock Exams (Oracle Certified Associate Java SE 7 Programmer 1 and 2 )

In this article, I am going to share some OCAJP 7 or 1Z0-803 exam and OCPJP 7 or 1Z0-804 certification sample questions and mock exam for practice which are completely free and available online. The sample questions are not good enough for thorough practice but you can use these mock tests to get an idea of what to expect in the actual exam. Many of the free mock questions are actually the samples questions provided by professional certification exam simulator provided e.g. Whizlabs, Enthuware, MyExamCloud etc, which are samples of their full-length exam simulators. As I have said many times in this blog that in order to succeed and do well on Java certification you must need a good study guide and a good exam simulator to practice well.