vendredi 20 mars 2020

In if statemen only one line of code is executed?

import java.util.*;
public class Main
{
  public static void main (String[]args)
  {
    Scanner in = new Scanner (System.in);
      System.out.println ("What is your annual income");
    int sal = in.nextInt ();
    if (sal > 10)
      {
    System.out.println ("Name");
    String name = in.nextLine ();
      System.out.println (name);
      }
  }
}

The above code is only executed till "System.out.println ("Name")" it does not move to next like and does not take input in my container "name" please help me out with this

Aucun commentaire:

Enregistrer un commentaire