An example to show callback function in JAVA