Answer:
The Java code is given below with appropriate comments as well as the sample output
Explanation:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
System.out.println("Enter a date in the form mon/day/year:");
Scanner scanner = new Scanner(System.in);
String inputDate = scanner. nextLine();
//Split the string string with / as the delimiter
String[] dateComponents = inputDate.split("/");
//Rearrange the date and month part and join with '.' as sepertor
String outputDate = String.join(".", dateComponents[1], dateComponents[0], dateComponents[2]);
System.out.println("Your date in European form is:\n" + outputDate);
}
}
<u>Sample Output
</u>
Output 1:
Enter a date in the form mon/day/year:
01/22/2020
Your date in European form is:
22.01.2020
Output 2:
Enter a date in the form mon/day/year:
1/22/20
Your date in European form is:
22.1.20