what is the difference between these 3?
def search(String id) { //code } Object search(String id) { //code } void search(String id) { //code }
specifically between def and Object .
def
Object
def is an alias for Object , so the first 2 signatures are identical.
the difference between 1st and 3rd is that you can return null or an instance of any class from 1 and 2, while you can only return null from 3rd.
Source: https://habr.com/ru/post/979975/More articles:Check if mobileconfig profile is installed on iOS - iosHow to enable ANSI colors in ConEmu + Git Bash? - git-bashHow to get NetBeans to process .cpp files as C ++ source code? - c ++Python 2 and 3 compatible way to iterate through a dict with key and value - pythonHow do spring aspects work inside? - javaExtending boost option with MPL list - c ++SCSS Web Essentials Compilation Error - visual-studio-2013Tkinter event_generate command ignored - pythonHow to translate javascript map using angular ng-repeat - javascriptUnexpected order of tkinter event_generate and update commands - unit-testingAll Articles