Im trying to get the output to read on one line such as this:
Reference String 1 2 3 where 1,2,3 is the number the user enters.
Instead the output is as such:
1 2 3 Reference String.
How can I improve this to read correctly?
import java.util.Scanner;
public class test {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Please enter length of string ");
int str_len=input.nextInt();
System.out.println("Please enter reference string ");
int[] count = new int[str_len];
//int str =input.nextInt();
int i;
for ( i=0; i<=str_len-1;i++)
{
count[i] = input.nextInt();
System.out.print( " " + count[i]);
}//ends for
System.out.print("Reference string is ");
}//ends class