I am trying to work on a code that tells me to enter some information but when I enter some of the info it duplicates the info to the next line before the next statement comes up. I was wondering how to keep it from doing that and how to put spaces between the answer to one statement and an another statement. Here is my code:
package stringactivity;
import java.util.Scanner;
public class StringMethods {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter your name: ");
System.out.print(keyboard.nextLine());
System.out.println(" Enter your age: ");
System.out.print(keyboard.nextLine());
System.out.println("Enter your gradePointAvg: ");
System.out.print(keyboard.nextLine());
System.out.println("Enter the letter grade you hope to get");
System.out.print(keyboard.nextLine());
}//end main
}//end class
and here is my output:
compile:
run:
Enter your name:
Jon
Jon Enter your age:
18
18Enter your gradePointAvg:
90
90Enter the letter grade you hope to get
A
ABUILD SUCCESSFUL (total time: 4 minutes 43 seconds)
--- Update ---
all I want is the name to be duplicated not the age, the grade Point Avg, and the Letter Grade that you hope to get
--- Update ---
and the name to be right in front of the last three information