how to keep on the same line. Help needed.
hello everyone. I would like to know how I can have a string appear on the same line after the program is run. i.e. after the user enters "hours", i want the text hours to appear next to it on the same line and not the next. sorry if I didnt' post this correctly.
public static void main (String[] args)
{
int hours, mins, secs, totalsecs;
Scanner inhours = new Scanner (System.in);
Scanner inmins = new Scanner (System.in);
Scanner insecs = new Scanner (System.in);
System.out.print ("Please enter the number of hours: ");
hours = inhours.nextInt(); System.out.print ("hours.");
System.out.println ();
mins = inmins.nextInt(); System.out.print ("minutes.");
System.out.println ();
secs = insecs.nextInt(); System.out.print ("seconds.");
System.out.println ();
System.out.println ();
int HOURS = hours * 3600;
int MINS = mins * 60;
int SECS = secs * 1;
totalsecs = HOURS + MINS + SECS;
System.out.println ("You entered " + hours + " hours," + mins + " minutes,"
+ secs + " seconds.");
System.out.println ("The given amount of time translates to "
+ totalsecs + " seconds.");
}
}