What does “an Arbitrary Object of a Particular Type” mean in java 8?

前端 未结 5 1089
一生所求
一生所求 2020-11-29 06:29

In Java 8 there is \"Method Reference\" feature. One of its kind is \"Reference to an instance method of an arbitrary object of a particular type\"

http://docs.oracl

5条回答
  •  余生分开走
    2020-11-29 07:09

    In this case there is an array of objects of a particular type(String) and any random object in array can call its instance method . This approach allows a class to refer to its instance method as if it is a static method .

    Also this approach works only for built in class of java like String but not for user defined class . In case of user defined class the instance method can only be referred by its object .

提交回复
热议问题