Write the code in Java:
1. Create a method that displays your name in the console. Thismethod is void and takes no parameters. Make an app that runs themethod in response to a button press.
2. Create a version of the method in #1 that takes the text(String) to be displayed as a parameter. Allow the user to enterthe text in a dialog box or text field and display that text in theconsole. Be sure to trim() the text.