I am trying to get input from user with a for loop but for example if user enters "2" as a "noOfSubPattern" loop does not wait for the second input. I cannot find what is wrong in my code.
int noOfSubPattern;
String subPattern = "";
noOfSubPattern = scan.nextInt();
for(int i = 0; i < noOfSubPattern; i++)
{
subPattern += scan.nextLine();
}