Returns the interfaces directly implemented by the class or interface represented by this object.
If this object represents a class, the return value is an array
containing objects representing all interfaces directly implemented by
the class. The order of the interface objects in the array corresponds
to the order of the interface names in the implements
clause of
the declaration of the class represented by this object. For example,
given the declaration:
class Shimmer implements FloorWax, DessertTopping { ...
}
suppose the value of s
is an instance of
Shimmer
; the value of the expression:
s.getClass().getInterfaces()[0]
is the Class
object that represents interface
FloorWax
; and the value of:
s.getClass().getInterfaces()[1]
is the Class
object that represents interface
DessertTopping
.
If this object represents an interface, the array contains objects
representing all interfaces directly extended by the interface. The
order of the interface objects in the array corresponds to the order of
the interface names in the extends
clause of the declaration of
the interface represented by this object.
If this object represents a class or interface that implements no interfaces, the method returns an array of length 0.
If this object represents a primitive type or void, the method returns an array of length 0.
If this Class
object represents an array type, the
interfaces Cloneable
and java.io.Serializable
are
returned in that order.
Diagram: Class, Package, Module