Input of string and int ,this gives runtime error

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);
int T=scn.nextInt();
while(T>0)
{
int n=scn.nextInt();
while(n>0)
{
String m=scn.nextLine();
int t=scn.nextInt();
System.out.print(m.charAt(0));
System.out.print(t);
n–;
}
T–;
}
}
}

take the string input by scn.next()
pls search the differece betwn nextLine() and next();
u will get the idea why ur code was showing error

hope this will help u
pls rate my work

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.