Question: Given string templateString on one line and string secondsString on a second line, assign timeString with a copy of templateString, where is replaced

Given string templateString on one line and string secondsString on a second line, assign timeString with a copy of templateString, where "" is replaced with secondsString.
Ex: If the input is:
Time allowed: 02:
16
then the output is:
Time allowed: 02:16
import java.util.Scanner;
public class ReplaceField {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String templateString;
String secondsString;
String timeString;
templateString = scnr.nextLine();
secondsString = scnr.next();
/* Your code goes here */
System.out.println(timeString);
}
}

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!