Issues with using delimiter
So basically, I'm trying to gather variables from keyboard input and split
up the variables using a comma. Though it doesn't seem to be working. It
is probably something simple I have overlooked but been trying for a while
and cannot figure it out.
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
scan.useDelimiter(",");
String str1 = scan.next();
String str2 = scan.next();
double num1 = scan.nextDouble();
double num2 = scan.nextDouble();
System.out.println(str1);
System.out.println(str2);
System.out.println(num1);
System.out.println(num2);
No comments:
Post a Comment