+ 1
Skee-ball challenge Java error [SOLVED]
import java.util.Scanner; import java.lang.*; public class Program { public static void main(String[] args) { Scanner xa = new Scanner(System.in); int a = xa.nextInt(); Scanner yb = new Scanner(System.in); int b = yb.nextInt(); if (a / 12 >= b) { System.out.println("Buy it!"); } else { System.out.println("Try again"); } } } I copied this method in other programming languages but I seem to get an error here in Java. Can someone help?
2 Answers
+ 4
Don't declare two scanners. Use the same one.
Scanner x = new Scanner(System.in);
int a = x.nextInt();
int b = x.nextInt();
+ 1
Ok Hatsy Rei, Thanks