I am new to java and I am supposed to get an output like the following:
Type in your first name: John
Hi, "John"
The name of this exercise is 'Modifying printing'.
Tabulator, line change and quotations have already been used in this exercise.
Backward slash (\) is also usable in printing.
End of exercise
But I couldn't get the name part, John, within " "
. Please any one help me. My code looks as follows:
import java.util.Scanner;
public class apples {
public static void main(String[] args) {
String s;
String m;
Scanner reader= new Scanner(System.in);
System.out.print("Type in your first name: ");
s= reader.nextLine();
m="Forward slash (\\) is also usable in printing.";
System.out.println();
System.out.println();
System.out.println("Hi, "+s);
System.out.println("\tThe name of this exercise is 'Modifying printing'.");
System.out.println("\tTabulator, line change and quotations have already been used in this exercise.");
System.out.println("\t"+m);
System.out.println();
System.out.println();
System.out.println("\t\t*** End of exercise ***");
}
}