The java.lang.reflect.Method.isDefault() method is used to check whether the method of the Method object is a Default Method: or not. It returns true if method object is a default method, otherwise it will return false.
Default Method: A public non-abstract on-static method with a body declared in an interface type.
public boolean isDefault()
Return Value: This method returns a boolean value. It returns true if method object is a default method by JVM Specifications, else false.
Below program illustrates isDefault() method of Method class:
Method: draw is Default Method
Default Methods of Comparator Interface reversed thenComparing thenComparing thenComparing thenComparingInt thenComparingLong thenComparingDouble
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.