java - NoSuchElement using scanner twice -


im is a working code that reads user input, so that I have a process that only the Has made, reads and returns string. . When it calls twice a process, a NoSuchElementException error which I can not do

input reader proc locate it:

  read public static string () {72 scanner Leer = new scanner (System.in); 73 string entry = leer.nextLine (); 74Lear.Clos (); 75 return entry; }  

How it can be used:

  ... system.out.println ("input value"); String padre = enter.rade (); System.out.println ("input value"); 27 string rempled = entrada.rade (); ...  

Getting im

  thread "exception in the" java.util.NoSuchElementException: a line found in java.util.Scanner.nextLine (unknown source modulocarga.Entrada.leerEntradaUsuario (Entrada.java:73) modulocarga.TablaSimbolica.addTaxonomica (TablaSimbolica.java:27) to (Principal.java:8) on modulocarga.Principal.main)  

The first time I call it works fine, it crashes, what can it be?

Since there is only one InputStream used its no longer possible to close input second method for reading the source

or the so-called scanner to avoid turning off (or example a single class of scanners application Closes at the end)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -