Unknown error in code



  • public static void main(String[] args) { 
    
        Scanner scan = new Scanner(System.in);
        int User = new scan.NextLine();
    }
    

    Why is there a code structure like that in the line?

    int User = new scan.NextLine();

    The word scan is underlined red as a mistake?



  • First: word new before scan.NextLine(); I don't... With help new a new facility is being created.

    Second: NextLine returns the line, and you still try it. int Put it... and it's inconsistencies.

    You have to. String User = scan.nextLine();

    or int User = Integer.parseInt(scan.nextLine()); / int User = scan.nextInt();

    which type do you really want? To get it.

    Thirdly: NextLine writing with a little letter. It's true. JavaNot C# :-


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2