What I am trying to do is have multiple inputs that all have different variables. Each variable will be part of different equations. I am looking for a way to do this, and I think I have an idea. I just want to know if this would be legal, and if there is a better way to do this.
import java.util.*;
public class Example{
public static void main(String args[]){
Scanner dd = new Scanner(System.in);
System.out.println("Enter number.");
int a = dd.nextInt();
System.out.println("Enter number.");
int b = dd.nextInt();
System.out.println("Enter number.");
int c = dd.nextInt();
}
}
nextInt()method does not deal with the EOL token, whilenextLine()does. There may be some times when you'll need to callnextLine()without saving the input just to handle the EOL token. It's not an issue in your current code, and there's no need to change it just yet.