+ 3
This code works fine on Eclipse, but not here. Any ideas? https://code.sololearn.com/cZJt6pScpbK0/?ref=app
3 Respuestas
+ 2
or
public class MySecondClass {
static Scanner input = new Scanner(System.in); // visible for all methods
public static void MAINS(){
...
+ 7
Create the a single Scanner in your class/main method and pass that scanner to your other methods:
...
static void main(String[] args)
{
Scanner input = new Scanner(System.in);
....
// Didn't check the names of each function..
MainMeal(input);
Salad(input);
Dessert(input);
....
input.close();
}
....
https://stackoverflow.com/a/13042296
+ 6
https://code.sololearn.com/cZJt6pScpbK0/?ref=app