Question: Solve the following question in Java. Question 3: [5 marks] Write a class named Greeter that implements a method named introductions, that prompts the user

Solve the following question in Java.

Solve the following question in Java. Question 3: [5 marks] Write a

Question 3: [5 marks] Write a class named Greeter that implements a method named introductions, that prompts the user for their name (using the java.util.Scanner class), displays a greeting, and returns the name as a String, as done in this python snippet: # defines the function only : def introductions (greeting): print (greeting) x = input ('Please enter your name :') print ('Hello,',x) return; # this function call actually calls the function, # which executes its code. username = introductions ('Welcome to my Python program!') Write your class based on this provided main method: public static void main(String[] args) { String username = introductions("Welcome to my Java program!"); System.out.println("got username "+username); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!