0
       public class Test {

   public static void main(String[] args) {

        try {
           int i;
           Scanner sc = new Scanner(System.in);
           System.out.println("Enter No :");
           int num =sc.nextInt();

           System.out.println(""+num);
           for(i=1;i<=num;i++)
            {
             System.out.println("Enter  : ");
             String line=sc.nextLine();
             //StringBuilder line1=fun(line);

             System.out.println("THE no is: "+line1);
            }


         }
        catch (Exception e)
         {
          e.printStackTrace();
         }
    } 

Here after giving the no the loop is iterating for the first time without taking the string input . How can I take the string input in each iteration.

ΦXocę 웃 Пepeúpa ツ
  • 43,054
  • 16
  • 58
  • 83
Rajdeep
  • 1
  • 1

0 Answers0