![]() |
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. Syntax: 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: Example 1:
Output:
Method: draw is Default Method Example 2:
Output:
Default Methods of Comparator Interface reversed thenComparing thenComparing thenComparing thenComparingInt thenComparingLong thenComparingDouble Reference: |
Reffered: https://www.geeksforgeeks.org
Java |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |