I'm trying code a basic application that will take the amount of numbers the user wants to input and then ask the user for the numbers, save the the numbers in a string array and then print them out in specific format.
this is what I have so far the only problem is I need to remove the last comma at the end of the output, I'm sure I'm going about this wrong... any assistance is appreciated.
import java.util.Scanner;
public class info {
    public void blue(){
        Scanner sc = new Scanner(System.in);
        Scanner dc = new Scanner(System.in);
        System.out.println("how many numbers do you have?");
        int a = dc.nextInt();
        System.out.println("enter your numbers");
        String index[]=new String [a];
        String i;
        for(int k = 0;k<index.length;k++){
            i = sc.nextLine();
            index[k]=i;
            }
            System.out.print("query (");
            for(int l = 0;l<index.length;l++){
            System.out.printf("'%s',",index[l]);
            }
            System.out.print(")");
    }
}
 
     
     
     
     
     
     
     
     
     
    