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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f308714a850_44066f30870b4248.jpg)
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
Get step-by-step solutions from verified subject matter experts
